Remove QNSView from superview in ~QCocoaWindow()

A QNSView without a corresponding live QCocoaWindow
object is not in a valid state. Previously we would
call removeFromSuperview for child QWindows to avoid
having Cocoa send messages to the now invalid QNSView.

Do this for QWindows embedded in native Cocoa
hierarchies as well.

Change-Id: I49c6daef8ed061b3f40138fe9b4ce6be190f2fd0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
This commit is contained in:
Morten Johan Sørvig 2015-05-11 21:56:57 +02:00
parent 406934a632
commit 7ffcf328c7

View File

@ -415,7 +415,7 @@ QCocoaWindow::~QCocoaWindow()
if (m_isNSWindowChild) {
if (m_parentCocoaWindow)
m_parentCocoaWindow->removeChildWindow(this);
} else if (parent()) {
} else if ([m_contentView superview]) {
[m_contentView removeFromSuperview];
}