QCocoaWindow.mm: Avoid crash whe using native windows
When using native windows, notification were received after the platform window pointer was cleaned up, which caused crashes. Change-Id: I438fc29d1761a32a4705c4c802afe46908505756 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
This commit is contained in:
parent
7212b52e85
commit
d178fd0bb8
@ -441,9 +441,12 @@ QCocoaWindow::~QCocoaWindow()
|
||||
m_parentCocoaWindow->removeChildWindow(this);
|
||||
} else if (parent()) {
|
||||
[m_contentView removeFromSuperview];
|
||||
} else if (m_qtView) {
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:m_qtView
|
||||
name:nil object:m_nsWindow];
|
||||
}
|
||||
|
||||
// Make sure to disconnect observer in all case if view is valid
|
||||
// to avoid notifications received when deleting when using Qt::AA_NativeWindows attribute
|
||||
if (m_qtView) {
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:m_qtView];
|
||||
}
|
||||
|
||||
// The QNSView object may outlive the corresponding QCocoaWindow object,
|
||||
|
Loading…
Reference in New Issue
Block a user