Skip to content

fix: release every route descriptor for a destination, not just the first - #1495

Merged
ndorin merged 1 commit into
releasefrom
fix/1494-release-all-route-descriptors
Sep 30, 2026
Merged

ndorin merged 1 commit into
releasefrom
fix/1494-release-all-route-descriptors

Conversation

@ndorin

@ndorin ndorin commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Fixes #1494.

Problem

An AudioVideo route is stored in RouteDescriptorCollection.DefaultCollection as two descriptors, one Audio and one Video. ReleaseRouteInternal called RemoveRouteDescriptor, which removes and returns only the first match, so only that one was released. On every route change to an AudioVideo destination the other descriptor was left behind. As a result:

  • each later release acted on a progressively older route
  • output ports' InUseTracker users (destination-Audio / destination-Video) were never all removed, so the counts never returned to zero
  • ClearRoute cleared the stale route's switch rather than the current one

Fix

  • RouteDescriptorCollection.RemoveRouteDescriptors(destination, inputPortKey = "") (new): removes and returns every descriptor for the destination, optionally limited to one input port, and raises RouteDescriptorCollectionChanged once.
  • ReleaseRouteInternal: releases every descriptor returned, and when clearing, clears ICurrentSources for the union of their signal types.
  • RoutingFeedbackManager: uses the new method instead of calling RemoveRouteDescriptor in a loop.
  • RemoveRouteDescriptor: behaviour unchanged, for compatibility with existing callers. Its docs now point to RemoveRouteDescriptors.

This follows the approach suggested in the issue. Filtering the lookup by signal type alone would have fixed the in-use counts but still released only one of the two descriptors.

Tests

New RouteDescriptorCollectionTests (5 tests):

  • both halves of an AudioVideo route are removed, and other destinations are untouched
  • the input-port filter leaves other inputs alone
  • no match returns empty and doesn't raise the changed event
  • releasing everything removed returns the output port's in-use count to 0
  • the issue's reproduction: cycling a display through six sources never accumulates descriptors, and each release acts on the previous source

All 54 tests in PepperDash.Essentials.Tests pass. The three bug-specific tests fail when RemoveRouteDescriptors is limited to the first match (the old behaviour). This hasn't been run on a processor yet.

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant