diff options
author | Axel Spoerl <[email protected]> | 2025-06-03 15:39:03 +0200 |
---|---|---|
committer | Tor Arne Vestbø <[email protected]> | 2025-06-03 18:56:07 +0000 |
commit | 36ebec92e81fb8ee7d965ad1a84221d6c779f562 (patch) | |
tree | f0fa935098e686c05e1ee34dcf79e096fa37315e | |
parent | 77f02471ed263d514c6f6edd170b97d2f6e7b44e (diff) |
QCocoaMenu: Explicitly remove NSMenu from supermenu on destruction
The d'tor of QCocoaMenu calls dismiss() to remove the current menu.
dismiss() calls cancelTracking, which doesn't always remove the
menu from its parent.
Remove the menu from its parent in addition.
Fixes: QTBUG-135634
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Ic8e9b4172c3b2035b7e9ad1b576725923987abf2
Reviewed-by: Tor Arne Vestbø <[email protected]>
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoamenu.mm | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index 4a51fe9d7c2..03df80b4634 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -44,6 +44,16 @@ QCocoaMenu::~QCocoaMenu() if (isOpen()) dismiss(); + + if (NSMenu *superMenu = m_nativeMenu.supermenu) { + for (NSMenuItem *item in superMenu.itemArray) { + if (item.submenu == m_nativeMenu) { + [superMenu removeItem:item]; + break; + } + } + } + [m_nativeMenu release]; } |