dsanders11

#52520: refactor: rework PowerMonitor 'shutdown' event on macOS to avoid UB

Merged
Created: Jul 29, 2026, 1:41:12 AM
Merged: Jul 30, 2026, 10:05:26 PM
3 comments
Target: main

Description of Change

Pulled out of #52418, as it was identified by the UBSan build. This is a latent bug that hasn't bit us yet because while Browser::SetShutdownHandler is called after Browser is deleted, the this pointer is never used in that function body.

In many ways Browser::SetShutdownHandler is a vestigial leftover from past code, so refactoring this to more cleanly separate concerns here.

Checklist

Release Notes

Notes: none

Backports

44-x-y
Merged
PR Number
#52572
Merged At
Jul 31, 2026, 1:55:08 AM
Released In
Not yet
Release Date
Not yet

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