Home

xmn / bettertrumpet

publicxammen/BetterTrumpet· sync paused
Overview Code History Branches Pull requestsIssuesInsights
master
HomeOverview Code PRsIssues

fix: debounce InvalidateWindowSize to prevent ItemsControl inconsistency during device churn

4 weeks ago

ccf364b
Authored
xammen8/24/2026, 9:20:29 PM
Rapid audio device connect/disconnect fires many CollectionChanged events
in <100ms. Each one triggered UpdateLayout immediately, and the
VirtualizingStackPanel's Verify() could run between two InsertItem calls,
detecting an accumulated count mismatch and crashing with
InvalidOperationException.

Now InvalidateWindowSize coalesces via a 16ms DispatcherTimer (one frame
at 60fps) so only the last invalidation in a burst actually triggers
layout, when the collection is already stable.

Parent932f6a0

1 file changed
  • EarTrumpet/UI/ViewModels/FlyoutViewModel.cs+19−2