Skip to content

fix: keep remote api::WebContents alive while their content::WebContents lives - #52994

Merged
MarshallOfSound merged 1 commit into
42-x-yfrom
manual-bp/42-x-y/52847
Aug 19, 2026
Merged

MarshallOfSound merged 1 commit into
42-x-yfrom
manual-bp/42-x-y/52847

Conversation

@VerteDinde

Copy link
Copy Markdown
Member

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 to main.

Notes: Fixed a rare crash in the main process when DevTools were opened and a garbage collection ran before the DevTools frontend finished loading.

…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)
@VerteDinde VerteDinde added backport This is a backport PR semver/patch backwards-compatible bug fixes 42-x-y labels Aug 18, 2026
@MarshallOfSound
MarshallOfSound enabled auto-merge (squash) August 19, 2026 07:16
@MarshallOfSound
MarshallOfSound merged commit 215dac9 into 42-x-y Aug 19, 2026
89 checks passed
@MarshallOfSound
MarshallOfSound deleted the manual-bp/42-x-y/52847 branch August 19, 2026 07:19
@release-clerk

release-clerk Bot commented Aug 19, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed a rare crash in the main process when DevTools were opened and a garbage collection ran before the DevTools frontend finished loading.

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

Labels

42-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants