Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: weakly reference MenuModel from MenuController #23778

Merged
merged 1 commit into from
May 27, 2020

Conversation

codebytere
Copy link
Member

@codebytere codebytere commented May 26, 2020

Description of Change

Refs:

Fixes a crash i've seen intermittently in Sentry on Catalina machines running Fiddle.

From the OG CL:

Before this CL, MenuController's contract required that the provided MenuModel outlived a MenuController instance. As of 10.15, it's impossible to fulfill that contract: AppKit seems to like keeping MenuController instances (via [NSMenuItem target]) alive until the next autorelease pool drain, and there's no way for the C++ code that creates & manages a MenuModel to know when that will happen.

This PR makes it such that ElectronMenuController holds a base::WeakPtr to its ElectronMenuModel, rather than a raw ptr, and handles the ElectronMenuModel being destroyed before the ElectronMenuController.

cc @MarshallOfSound @zcbenz

Checklist

Release Notes

Notes: Fixed an occasional menu crash on macOS Catalina when menu is closing.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label May 26, 2020
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label May 27, 2020
@codebytere codebytere merged commit 7b0a844 into master May 27, 2020
@release-clerk
Copy link

release-clerk bot commented May 27, 2020

Release Notes Persisted

Fixed an occasional menu crash on macOS Catalina when menu is closing.

@trop
Copy link
Contributor

trop bot commented May 27, 2020

I have automatically backported this PR to "10-x-y", please check out #23806

@trop trop bot removed the target/10-x-y label May 27, 2020
@trop
Copy link
Contributor

trop bot commented May 27, 2020

I have automatically backported this PR to "8-x-y", please check out #23807

@trop
Copy link
Contributor

trop bot commented May 27, 2020

I have automatically backported this PR to "9-x-y", please check out #23808

@trop trop bot added the merged/9-x-y label May 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants