DYN-10640: Port context menu flashes for a split second then disappears#17183
Conversation
comments updated
There was a problem hiding this comment.
See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-10640
Guard against the case where Dispose() is called before the Unloaded event fires, which would leave the WorkspaceView rooted via the Deactivated handler on the owner Window. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
|
Added a small cleanup in |
jasonstratton
left a comment
There was a problem hiding this comment.
Needed a simple additional cleanup in WorkspaceView.dispose() method. I just added it myself.
Looks good. Approved and merging
| RemoveViewModelsubscriptions(ViewModel); | ||
| DataContextChanged -= OnWorkspaceViewDataContextChanged; | ||
| Loaded -= WorkspaceView_Loaded; | ||
| Unloaded -= WorkspaceView_Unloaded; |
There was a problem hiding this comment.
Missing one bit of cleanup, unsubscribing to OwnerWindow_Deactivated.
Simple change. I'll add it and merge.
|




Purpose
This PR fixes DYN-10639, a regression introduced in #16763 where the port context menu briefly flashes and then disappears when opened with a left mouse click.
This PR makes WorkspaceView subscribe to its owner window's Deactivated event and close the port context menu when Dynamo loses focus:
WorkspaceView_Loaded/WorkspaceView_Unloaded- resolve the owner window viaWindow.GetWindow(this)and subscribe/unsubscribe the Deactivated handler. The cachedownerWindowfield guarantees we unsubscribe from the exact same window in Unloaded/Dispose.OwnerWindow_Deactivated- closes the port context menu viaDestroyPortContextMenu()on window deactivation.Declarations
Check these if you believe they are true
Release Notes
Port context menu does not flash only for a split second when called with left mouse click and closed when the owner window loses focus.
Reviewers
@DynamoDS/eidos
@jasonstratton
@johnpierson
FYIs
@dnenov