Fix tst_QDialog::deleteInExec() crash on Mac OS X

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>
This commit is contained in:
Bradley T. Hughes 2012-04-16 12:14:35 +02:00 committed by Qt by Nokia
parent a2e42a6a0a
commit 5a57ddebf5
2 changed files with 0 additions and 2 deletions

View 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.

View File

@ -2,4 +2,3 @@ CONFIG += testcase
TARGET = tst_qdialog
QT += widgets testlib
SOURCES += tst_qdialog.cpp
mac:CONFIG += insignificant_test # QTBUG-24977