Cocoa integration - avoid dangling menuitem pointer
Since QCocoaMenu can live longer than its m_attachedItem pointer, this pointer is becoming invalid after QCocoaMenuItem deleted (and its 'm_native' was released). Task-number: QTBUG-53251 Change-Id: I6d97b75b2c09e2443cd21415c5db94206d5d89ce Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
This commit is contained in:
parent
45bec92e7a
commit
4e0b76d810
@ -110,6 +110,8 @@ QCocoaMenuItem::~QCocoaMenuItem()
|
|||||||
if (m_merged) {
|
if (m_merged) {
|
||||||
[m_native setHidden:YES];
|
[m_native setHidden:YES];
|
||||||
} else {
|
} else {
|
||||||
|
if (m_menu && m_menu->attachedItem() == m_native)
|
||||||
|
m_menu->setAttachedItem(nil);
|
||||||
[m_native release];
|
[m_native release];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user