Fix six defects found by the pie rendering stack audit - #75
Merged
Conversation
With KeepMenuOpenAfterSliceClick enabled, clicking a slice while holding the activation hotkey left the release latch armed, so releasing the hotkey executed the same slice a second time.
Since the pie stopped rebuilding on every open, a press-and-hold that ended while the menu was hidden left the drag candidate armed. Moving over that slice with the button held in the next open then started a reorder drag measured against the stale press position, and a stale active drag would silently disable the hotkey-release flick.
Releasing the activation hotkey triggered the mouse-hovered slice even while arrow keys had a different slice highlighted, so the visual selection and the executed action could disagree. The release decision now lives in a pure helper that honors the interaction mode.
The reorder commit runs from the settle animation callback. A rebuild landing during those 150 ms (settings edit, theme change, slice toggle) replaces the visuals, and looking up the target slot with First threw InvalidOperationException into the dispatcher. Fall back to the existing warning path instead.
The build clears the pending flag up front, so its failure early-returns (zero size, no enabled slices, layout failure) left a blank pie that a later open would not repair now that opens no longer rebuild unconditionally. Re-arm the flag on those paths so the next visibility change retries.
SystemEvents.UserPreferenceChanged is raised on whichever thread owns the broadcast window; the refresh path reads dependency properties and would throw off the UI thread. MainWindow already guards its settings handler the same way.
Pixel snapping and the shadow BitmapCache scale are captured at build time, and a move to a different-DPI monitor changes neither the DIP size nor any other rebuild trigger, so the ring rendered soft until an unrelated event forced a rebuild.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
An exhaustive audit of the
Pie/*stack (focused on the interactions between #67-#73) verified 12 defect hypotheses via an instrumented build driven by a UI harness, STA-hosted tests, and code trace. Four confirmed bugs and three latent ones are fixed here, one commit each:KeepMenuOpenAfterSliceClick, clicking a slice while holding the hotkey left the release latch armed, so releasing it executed the slice again (twice total, verified live). The latch now clears when a slice fires._dragCandidatearmed; moving over that slice with the button held in the next open started a drag with no press (verified live). Drag tracking now resets on open.CommitReorderthrowInvalidOperationExceptionon a stale slot lookup (verified in an STA test). It now falls back to the existing warning path.SystemEvents.UserPreferenceChangedcan be raised on a worker thread and the handler reads dependency properties (cross-thread throw verified in an STA test; delivery was on the UI thread in all live probes). Handlers now marshal to the dispatcher.BitmapCachescale are baked at build DPI and nothing re-triggered a rebuild on a DPI change (mechanism code-verified; not runtime-testable on a uniform-DPI machine).OnDpiChangednow requests a rebuild.Verification
main: 28 of 121,905 pixels differ within anti-aliasing tolerance (max delta 14) - no visual change.dotnet test: 148/148 passing, including new cases for the release-trigger decision.The audit also refuted five suspected defects (stale-hover flick, press-scale leak across opens, shadow-halo clipping from the #72
BitmapCache, reduced-motion reorder reentrancy, hidden-refresh coalescing) and found one new issue, filed separately as #74 (clicks fall through during the fade-in).