From 5a57ddebf5033e6c60ac34adf81a21a6a18ad7e6 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Mon, 16 Apr 2012 12:14:35 +0200 Subject: [PATCH] Fix tst_QDialog::deleteInExec() crash on Mac OS X MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/plugins/platforms/cocoa/qcocoawindow.mm | 1 - tests/auto/widgets/dialogs/qdialog/qdialog.pro | 1 - 2 files changed, 2 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index de58842772..af8f039d94 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -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. diff --git a/tests/auto/widgets/dialogs/qdialog/qdialog.pro b/tests/auto/widgets/dialogs/qdialog/qdialog.pro index 779c10ed66..2c4d10dd0b 100644 --- a/tests/auto/widgets/dialogs/qdialog/qdialog.pro +++ b/tests/auto/widgets/dialogs/qdialog/qdialog.pro @@ -2,4 +2,3 @@ CONFIG += testcase TARGET = tst_qdialog QT += widgets testlib SOURCES += tst_qdialog.cpp -mac:CONFIG += insignificant_test # QTBUG-24977