fix: prevent orphan leak in SetContentView#52092
Open
gostoshbs wants to merge 1 commit into
Open
Conversation
Contributor
|
For more information on signing commits, see GitHub's documentation on Telling Git about your signing key. |
This comment has been minimized.
This comment has been minimized.
SetContentView detached the previous content view with RemoveChildView, which removes it from the view hierarchy without destroying it. For views Electron owns (not owned_by_client), this leaked the view on every replacement. Use RemoveChildViewT to delete views we own, keep RemoveChildView for client owned views that must outlive removal, and clear content_view_/focused_view_ before removal so neither references a destroyed view.
266cd38 to
b8e69f9
Compare
Member
|
Related issue for anyone viewing the PR: #48565 (Definitely not necessary to implement this in this PR!) |
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.
Description of Change
SetContentView detached the previous content view with RemoveChildView, which removes it from the view hierarchy without destroying it. For views Electron owns (not owned_by_client), this leaked the view on every replacement.
Use RemoveChildViewT to delete views we own, keep RemoveChildView for client owned views that must outlive removal, and clear content_view_/focused_view_ before removal so neither references a destroyed view.
Ref #21586.
Checklist
I have built and tested this change
I have filled out the PR description
I have reviewed and verified the changes
npm testpassestests are changed or added
[ ]
I experimented with different options, but, found no suitable automated way to assert fix from a typescript based test over a short duration
PR release notes describe the change in a way relevant to app developers, and are capitalized, punctuated, and past tense.
Release Notes
Notes: Fixed a memory leak when creating BrowserWindows.