Skip to content

[Cherry-pick] DYN-9903: Avoid using closed Window as EditWindow owner#17035

Merged
zeusongit merged 1 commit intoRC4.1.0_masterfrom
cherrypick-17014
Apr 9, 2026
Merged

[Cherry-pick] DYN-9903: Avoid using closed Window as EditWindow owner#17035
zeusongit merged 1 commit intoRC4.1.0_masterfrom
cherrypick-17014

Conversation

@github-actions
Copy link
Copy Markdown

@github-actions github-actions Bot commented Apr 9, 2026

Cherry-pick of #17014 to RC4.1.0_master

Purpose

Crash Fix

dynamoViewModel.Owner is a mutable property that gets temporarily redirected to child windows (Package Manager, Preferences) so dialogs opened from within those windows are centered correctly. Neither window restored the owner back to the main DynamoView on close, leaving a stale reference to a closed window. Any subsequent EditWindow construction (node rename, note edit) would crash with InvalidOperationException: Cannot set owner to a Window that has been closed.

Added 2 tests

WhenDynamoViewModelOwnerIsClosedWindowThenEditWindowDoesNotThrow

  • Directly reproduces the crash: sets ViewModel.Owner to a closed Window (what PackageManager/Preferences leaves behind), then constructs EditWindow.
  • Would have failed before the IsLoaded guard added to EditWindow.xaml.cs:36 with InvalidOperationException: Cannot set owner to a Window that has been closed.

WhenChildWindowClosesOwnerIsRestoredToDynamoView

  • Verifies the contract that prevents the bug: when a child window closes, ViewModel.Owner must be back to the main DynamoView.
  • Validates the pattern implemented in HandlePackageManagerWindowClosed and PreferencesView.CloseButton_Click

Declarations

Check these if you believe they are true

Release Notes

Fixes a crash (InvalidOperationException) when renaming a node after the Package Manager or Preferences window had been opened and closed.

@github-actions github-actions Bot added this to the 4.1 milestone Apr 9, 2026
@zeusongit zeusongit merged commit 61da899 into RC4.1.0_master Apr 9, 2026
9 checks passed
@zeusongit zeusongit deleted the cherrypick-17014 branch April 9, 2026 15:50
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 9, 2026

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant