jkleinsc

#55982: fix: dangling pointer when releasing an OSR shared texture in the paint handler

Merged
Created: Nov 20, 2026, 9:30:24 AM
Merged: Nov 24, 2026, 4:20:55 PM
6 comments
Target: main

Description of Change

Recently there have been shared textured dangling-pointer crashes in CI, for example failed job #1 and failed job #2.

OffscreenSharedTextureValue held a non-owning raw_ptr to the heap OffscreenReleaserHolder, and ownership passed to the JS texture's release monitor. Calling texture.release() synchronously from a paint handler freed the holder while the native value was still on the stack in OffScreenVideoConsumer::OnFrameCaptured. When the value was destroyed, the dangling raw_ptr check fired and crashed the browser process with SIGTRAP. This intermittently killed the api-shared-texture spec worker on macOS arm64.

This PR makes the holder ref-counted, and have both the in-flight value and the release monitor hold a scoped_refptr. release() now drops only the JS reference, and the frame goes back to the capturer's pool when the last reference is gone.

This PR also adds a regression test that releases the texture synchronously inside the paint handler. It crashes deterministically without this change.

Checklist

Release Notes

Notes: Fixed dangling pointer when releasing a shared texture.

Backports

44-x-y
Pending
Waiting for a manual backport
45-x-y
Merged
PR Number
#56054
Merged At
Nov 24, 2026, 7:40:16 PM
Released In
Not yet
Release Date
Not yet
46-x-y
In-flight
PR Number
#56053
Waiting to be merged

Semver Impact

Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.

Semantic Versioning helps users understand the impact of updates:

  • Major (X.y.z): Breaking changes that may require code modifications
  • Minor (x.Y.z): New features that maintain backward compatibility
  • Patch (x.y.Z): Bug fixes that don't change the API
  • None: Changes that don't affect using facing parts of Electron