Skip to content

fix: remove early capturer_.reset() that causes nullptr deref on next refresh#51787

Merged
jkleinsc merged 1 commit into
electron:42-x-yfrom
erickzhao:42/nullptr-crash
May 28, 2026
Merged

fix: remove early capturer_.reset() that causes nullptr deref on next refresh#51787
jkleinsc merged 1 commit into
electron:42-x-yfrom
erickzhao:42/nullptr-crash

Conversation

@erickzhao

@erickzhao erickzhao commented May 27, 2026

Copy link
Copy Markdown
Member

Backport of #51329

See that PR for details. This commit was not backported as part of #51506, although the PR body mentions that it should:

Note for if/when we backport the desktopCapturer refactor to older branches: dad4ab6 , a1d28e6, bef68b6, and now this PR.

Release Notes

Notes: Fixed a desktopCapturer crash when sharing a window on Windows.

…xt refresh (electron#51329)

fix: remove early capturer_.reset() that causes null deref on next refresh

Another followup to dad4ab6: remove the `capturer_.reset()` that
`desktop_media_list.patch` was adding `Worker::RefreshNextThumbnail()`.
Since we switched from the one-shot Update() model to the continuous
StartUpdating() model, resetting `capturer_` isn't necessary and is
now dangerous: ScheduleNextRefresh() posts a delayed Worker::Refresh()
that dereferences capturer_, causing a nullptr crash.

Under CI load, the NativeDesktopMediaList can survive long enough
for the next 1-second refresh cycle to fire before FinalizeList()
destroys it. The crash can manifest as either a SIGSEGV or a
DCHECK(can_refresh()) failure, which is extra fun because dad4ab6
was fixing a similar DCHECK crash in the first place.

Sample crash:

```
[6690:0426/173732.876803:FATAL:chrome/browser/media/webrtc/native_desktop_media_list.cc:934] DCHECK failed: can_refresh().0x00000001337aa7f3 NativeDesktopMediaList::RefreshForVizFrameSinkWindows(...) + 131
```
@erickzhao erickzhao requested a review from a team as a code owner May 27, 2026 23:47
@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label May 27, 2026
@trop trop Bot added 42-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels May 27, 2026
@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label May 27, 2026
@jkleinsc jkleinsc enabled auto-merge (squash) May 28, 2026 02:04
@jkleinsc jkleinsc merged commit d3f8d53 into electron:42-x-y May 28, 2026
129 of 132 checks passed
@release-clerk

release-clerk Bot commented May 28, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed a desktopCapturer crash when sharing a window on Windows.

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.

5 participants