Fix tst_QDialog::deleteInExec() crash on Mac OS X
authorBradley T. Hughes <bradley.hughes@nokia.com>
Mon, 16 Apr 2012 10:14:35 +0000 (12:14 +0200)
committerQt by Nokia <qt-info@nokia.com>
Tue, 17 Apr 2012 01:28:29 +0000 (03:28 +0200)
When destroying a window immediately after showing it, we can sometimes
provoke a crash in Cocoa after the show-window-animation has finished
(which appears to assume that the window's view will always be valid).
Prevent the crash by not removing the view from the window. When
recreating a window, we explicitly release the old window, but we do not
release the view, so we can freely add it to the new window (i.e. this
does not introduce new bugs related to recreating the platform window).

Task-number: QTBUG-24977
Change-Id: I466ce75b04785401032a0a2d4a2c494910cd1672
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
src/plugins/platforms/cocoa/qcocoawindow.mm
tests/auto/widgets/dialogs/qdialog/qdialog.pro

index de58842..af8f039 100644 (file)
@@ -479,7 +479,6 @@ 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.
index 779c10e..2c4d10d 100644 (file)
@@ -2,4 +2,3 @@ CONFIG += testcase
 TARGET = tst_qdialog
 QT += widgets testlib
 SOURCES += tst_qdialog.cpp
-mac:CONFIG += insignificant_test    # QTBUG-24977