Repository navigation
Fix: Prevent menu update while it's open - #12809
Conversation
Menu change should be prevented while the menu is open
|
|
||
| namespace api { | ||
|
|
||
| static NSMenu* applicationMenu_ = nil; |
There was a problem hiding this comment.
Why does this have to be static?
There was a problem hiding this comment.
@MarshallOfSound With the static keyword, applicationMenu_ remains visible only to this translation unit when the file is compiled.
There was a problem hiding this comment.
shouldn't it be in an unnamed namespace then? That's what we use in other obj-c files, e.g.:
./atom/browser/ui/drag_util_mac.mm:namespace {
./atom/browser/ui/tray_icon_cocoa.mm:namespace {
./atom/browser/ui/file_dialog_mac.mm:namespace {
./atom/browser/ui/message_box_mac.mm:namespace {
./atom/browser/auto_updater_mac.mm:namespace {
./atom/browser/auto_updater_mac.mm:namespace {
./atom/browser/api/atom_api_browser_window_mac.mm:namespace {
./atom/browser/api/atom_api_system_preferences_mac.mm:namespace {
./atom/browser/mac/atom_application.mm:namespace {
./atom/browser/mac/in_app_purchase_observer.mm:namespace {
./atom/common/platform_util_mac.mm:namespace {
./atom/app/atom_main_delegate_mac.mm:namespace {
|
|
||
| namespace { | ||
|
|
||
| static NSMenu* applicationMenu_ = nil; |
There was a problem hiding this comment.
We shouldn't need static here while in the namespace right?
There was a problem hiding this comment.
@MarshallOfSound I'd prefer having the static keyword there so it won't conflict with other applicationMenu_ in other files in the future due to redefinition.
Here are some other usages of this keyword that I've found:
./atom/browser/mac/atom_application_delegate.mm
22,1: static base::mac::ScopedObjCClassSwizzler* g_swizzle_imk_input_session;
./atom/browser/api/atom_api_power_monitor_mac.mm
64,1: static MacLockMonitor* g_lock_monitor = nil;
./atom/browser/ui/cocoa/atom_touch_bar.mm
15,1: static NSTouchBarItemIdentifier ButtonIdentifier =
17,1: static NSTouchBarItemIdentifier ColorPickerIdentifier =
19,1: static NSTouchBarItemIdentifier GroupIdentifier =
21,1: static NSTouchBarItemIdentifier LabelIdentifier =
23,1: static NSTouchBarItemIdentifier PopoverIdentifier =
25,1: static NSTouchBarItemIdentifier SliderIdentifier =
27,1: static NSTouchBarItemIdentifier SegmentedControlIdentifier =
29,1: static NSTouchBarItemIdentifier ScrubberIdentifier =
32,1: static NSString* const TextScrubberItemIdentifier = @"scrubber.text.item";
33,1: static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
./atom/browser/ui/cocoa/atom_menu_controller.mm
62,1: static base::scoped_nsobject<NSMenuItem> recentDocumentsMenuItem_;
65,1: static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
|
This CI failure looks like a flake to me. Re-starting the job |
|
Is this ready to go? Seems ready to me |
|
/trop run backport-to 2-0-x |
|
The backport process for this PR has been manually initiated, sending your 1's and 0's to "2-0-x" here we go! :D |
|
/trop run backport-to 2-0-x |
|
The backport process for this PR has been manually initiated, sending your 1's and 0's to "2-0-x" here we go! :D |
|
An error occurred while attempting to backport this PR to "2-0-x", you will need to perform this backport manually |
Yeah, don't know what happened with the first trop, second one errored out legitimately 👍 |
|
@sethlu, @MarshallOfSound, @codebytere: does this also need to be fixed in |
|
@ckerr I don't think we need to. It's merged before we cut for |
Menu change should be prevented while the menu is open
Fixes: #12636