Repository navigation
fix: prevent orphan leak in SetContentView - #52092
Conversation
|
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.
266cd38 to
b8e69f9
Compare
|
Related issue for anyone viewing the PR: #48565 (Definitely not necessary to implement this in this PR!) |
ckerr
left a comment
There was a problem hiding this comment.
The fix LGTM, thanks for the PR!
It looks like native_window_mac.mm:374 has the same issue. @gostoshbs could you fix it there too? Looks to me like the fix would be the same, minus the focused_view_ = nullptr; since the mac code doesn't have that field
b8e69f9 to
a281839
Compare
|
Thanks for having a look. I've pushed the macos equivalent based on your suggestions. One disclaimer, I do not have the capability to build or run the same tests on this platform as I do linux |
|
@gostoshbs Can you rebase your branch on main? That should restart the skipped tests |
a281839 to
add5476
Compare
add5476 to
e78466d
Compare
|
Heads up: Windows CI builds moved to new runners on Monday and the old ones have now been removed. This branch predates that, so its Windows build jobs still point at the old runners and will sit queued forever if CI runs again. Rebasing on |
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.
e78466d to
e0cddd6
Compare
|
Congrats on merging your first pull request! 🎉🎉🎉 |
|
Release Notes Persisted
|
|
I have automatically backported this PR to "43-x-y", please check out #52892 |
|
I have automatically backported this PR to "42-x-y", please check out #52893 |
|
I have automatically backported this PR to "44-x-y", please check out #52894 |
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.