From 08dd4fd7f4ca9e26944dfb7044a48e2db9dfa9aa Mon Sep 17 00:00:00 2001 From: "smichaud%pobox.com" Date: Fri, 18 Apr 2008 15:05:37 +0000 Subject: [PATCH] Crash on quit when only an extension's custom window is open. b=429215 r=josh sr=vlad a=vlad --- widget/src/cocoa/nsMenuBarX.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/widget/src/cocoa/nsMenuBarX.mm b/widget/src/cocoa/nsMenuBarX.mm index 78415c7c77d..673b5604c5d 100644 --- a/widget/src/cocoa/nsMenuBarX.mm +++ b/widget/src/cocoa/nsMenuBarX.mm @@ -119,6 +119,9 @@ nsMenuBarX::~nsMenuBarX() { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; + if (nsMenuBarX::sLastGeckoMenuBarPainted == this) + nsMenuBarX::sLastGeckoMenuBarPainted = nsnull; + mMenusArray.Clear(); // release all menus // the quit/pref items of a random window might have been used if there was no @@ -997,6 +1000,8 @@ static BOOL gMenuEffectsOnly = NO; int tag = [sender tag]; nsMenuBarX* menuBar = nsMenuBarX::sLastGeckoMenuBarPainted; + if (!menuBar) + return; // We want to avoid processing app-global commands when we are asked to // perform native menu effects only. This avoids sending events twice,