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.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> (cherry picked from commit 641422686dc82627af829a405c4af570d78ab8cc)
This commit is contained in:
parent
de480b0ed8
commit
2c686e47b7
@ -44,6 +44,16 @@ QCocoaMenu::~QCocoaMenu()
|
|||||||
|
|
||||||
if (isOpen())
|
if (isOpen())
|
||||||
dismiss();
|
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];
|
[m_nativeMenu release];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user