summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2012-03-23 12:53:35 +0100
committerQt by Nokia <qt-info@nokia.com>2012-03-26 11:41:07 +0200
commita9c49816a7008cf6e181fe66d7644a64c10faf17 (patch)
tree92347757c5419bec0f82da4a1e10ef15bb863881 /src
parentd8508b813950cad79600acb49ef5bef837f04934 (diff)
Cocoa: QCocoaWindow::clearNSWindow() needs to cleanup properly
clearNSWindow() should also clear the delegate and remove the contentView from the window, since we are no longer using that window. Make sure the QCocoaWindow::~QCocoaWindow() doesn't release the m_contentView until after clearNSWindow(), to avoid crashes while trying to cleanup the window and view. Change-Id: Ia081488f629a4fd4cf10fb1053fb8183b1914d35 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 46c100649f..4f95489798 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -111,8 +111,8 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw)
QCocoaWindow::~QCocoaWindow()
{
- [m_contentView release];
clearNSWindow(m_nsWindow);
+ [m_contentView release];
[m_nsWindow release];
}
@@ -449,7 +449,9 @@ void QCocoaWindow::setNSWindow(NSWindow *window)
void QCocoaWindow::clearNSWindow(NSWindow *window)
{
+ [window setDelegate:nil];
[[NSNotificationCenter defaultCenter] removeObserver:m_contentView];
+ [m_contentView removeFromSuperviewWithoutNeedingDisplay];
}
// Returns the current global screen geometry for the nswindow associated with this window.