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.9 6.8 6.5 Change-Id: Ic8e9b4172c3b2035b7e9ad1b576725923987abf2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 36ebec92e81fb8ee7d965ad1a84221d6c779f562) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
3afa63c30c
commit
641422686d
@ -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];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user