diff options
-rw-r--r-- | src/gui/widgets/qmenu_mac.mm | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm index 8b371e5..30bbd31 100644 --- a/src/gui/widgets/qmenu_mac.mm +++ b/src/gui/widgets/qmenu_mac.mm @@ -763,7 +763,9 @@ QMacMenuAction::~QMacMenuAction() { #ifdef QT_MAC_USE_COCOA [menu release]; - if (action) { + // Update the menu item if this action still owns it. For some items + // (like 'Quit') ownership will be transferred between all menu bars... + if (action && action.data() == reinterpret_cast<QAction *>([menuItem tag])) { QAction::MenuRole role = action->menuRole(); // Check if the item is owned by Qt, and should be hidden to keep it from causing // problems. Do it for everything but the quit menu item since that should always @@ -774,11 +776,7 @@ QMacMenuAction::~QMacMenuAction() && menuItem != [getMenuLoader() quitMenuItem]) { [menuItem setHidden:YES]; } - // Only clear the tag if it points to this action. Since items like - // 'Quit' is being reused, we sometimes end up redirecting the item - // before deleting the assosiated action. - if (action.data() == reinterpret_cast<QAction *>([menuItem tag])) - [menuItem setTag:nil]; + [menuItem setTag:nil]; } [menuItem release]; #endif |