From da267503528f8afcb42327ec8e96cd7518dbdec9 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Fri, 3 May 2024 10:11:21 -0400 Subject: [PATCH] fix: recentDocuments on macOS not working (#41992) 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 a821f0b12be6..c6153ce0bc06 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 c1546b7b2816..084424a2e4bc 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"},