Repository navigation
fix: keep remote api::WebContents alive while their content::WebContents lives - #52994
Merged
Merged
Conversation
…nts lives (#52847) * fix: keep remote api::WebContents alive while their content::WebContents lives The api::WebContents wrapping a DevTools WebContents is created up front in InspectableWebContents::ShowDevTools but only referenced again once the frontend has loaded. It is a kRemote WebContents, so nothing pinned it and a GC in between collected its wrapper; DevToolsOpened() then either got an empty handle back from FromOrCreate() and crashed dereferencing it, or created a second api::WebContents for the same DevTools WebContents. Pin remote api::WebContents in the constructor and unpin them in WebContentsDestroyed(), the same mechanism background pages already use. Fixes #52158 * chore: format spec No-Verification-Needed: formatting-only change (cherry picked from commit 881d822)
4 tasks done
MarshallOfSound
enabled auto-merge (squash)
August 19, 2026 07:16
MarshallOfSound
approved these changes
Aug 19, 2026
codebytere
approved these changes
Aug 19, 2026
|
Release Notes Persisted
|
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.
Backport of #52847
See that PR for details.
Manual backport notes: spec conflict was positional only (the neighbouring right-docked DevTools test is
main-only); only this change's regression test is added. C++ hunk identical tomain.Notes: Fixed a rare crash in the main process when DevTools were opened and a garbage collection ran before the DevTools frontend finished loading.