From 844265303c5586509a3c12058adb2dc80d67eb9e Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Wed, 1 May 2024 11:52:20 -0400 Subject: [PATCH] fix: recentDocuments on macOS not working (#41993) Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr Co-authored-by: John Kleinschmidt --- shell/browser/ui/cocoa/electron_menu_controller.h | 2 -- shell/browser/ui/cocoa/electron_menu_controller.mm | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/shell/browser/ui/cocoa/electron_menu_controller.h b/shell/browser/ui/cocoa/electron_menu_controller.h index a821f0b12be..c6153ce0bc0 100644 --- a/shell/browser/ui/cocoa/electron_menu_controller.h +++ b/shell/browser/ui/cocoa/electron_menu_controller.h @@ -26,8 +26,6 @@ class ElectronMenuModel; @protected base::WeakPtr model_; NSMenu* __strong menu_; - NSMenuItem* __strong recentDocumentsMenuItem_; - NSMenu* __strong recentDocumentsMenuSwap_; BOOL isMenuOpen_; BOOL useDefaultAccelerator_; base::OnceClosure closeCallback; diff --git a/shell/browser/ui/cocoa/electron_menu_controller.mm b/shell/browser/ui/cocoa/electron_menu_controller.mm index c1546b7b281..084424a2e4b 100644 --- a/shell/browser/ui/cocoa/electron_menu_controller.mm +++ b/shell/browser/ui/cocoa/electron_menu_controller.mm @@ -31,10 +31,14 @@ using SharingItem = electron::ElectronMenuModel::SharingItem; namespace { +static NSMenuItem* __strong recentDocumentsMenuItem_; +static NSMenu* __strong recentDocumentsMenuSwap_; + struct Role { SEL selector; const char* role; }; + Role kRolesMap[] = { {@selector(orderFrontStandardAboutPanel:), "about"}, {@selector(hide:), "hide"},