nmggithub

#51586: fix: don't return a nullptr from TargetForRect

Merged
Created: May 11, 2026, 1:03:17 PM
Merged: May 13, 2026, 1:45:27 PM
11 comments
Target: main

Description of Change

Resolves #51576.

The above bug was introduced by this PR: #50330.

While well-intentioned, the choice to return nullptr from a function whose contract does not explicitly allow it caused a nullptr-dereference exception inside Chromium.

  1. RootView::UpdateCursor
  2. View* View::GetEventHandlerForPoint
  3. View* View::GetEventHandlerForRect
  4. ViewTargeter:TargetForRect returns nullptr
  5. RootView::UpdateCursor attempts to dereference the nullptr

Checklist

Release Notes

Notes: Fixed a crash on MacOS when a user clicked into a title bar or top view.

Backports

42-x-y
In-flight
PR Number
#51605
Waiting to be merged
43-x-y
In-flight
PR Number
#51606
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