VerteDinde

#49648: fix: remove menu observer before destroying menu_controller_

Merged
Created: Feb 3, 2026, 12:42:17 PM
Merged: Feb 4, 2026, 9:11:01 AM
3 comments
Target: main

Description of Change

Follow up to #48351

A previous refactor uncovered a long-standing bug in MenuMac::~MenuMac() 's lifetime cycle: When MenuMac::~MenuMac() was being destroyed by GC, during implicit destruction of menu_controller_, it could trigger callbacks to the model through observer notifications. Menu::~Menu() ran after, removing the observer too late.

This PR moves the observer cleanup from Menu::~Menu() to MenuMac::~MenuMac(), removing the observer before menu_controller_ is destroyed and preventing callbacks during the deallocation.

Checklist

Release Notes

Notes: Fixed an application crash on MacOS where the menu observer was not being properly removed before garbage collection.

Backports

40-x-y
Merged
PR Number
#
Merged At
Released In
Not yet
Release Date
Not yet
41-x-y
Merged
PR Number
#
Merged At
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