Cocoa: Don't send duplicate close events.

Use the presence of a platform window to detect
if the QWindow has already been closed.

Change-Id: Ieedf231cc5b805ed6383e55a82ca137087805a4f
Task-number: QTBUG-43344
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
bb10
Morten Johan Sørvig 2015-09-11 13:05:17 +02:00
parent 20918435b6
commit 2d6f9b6148
1 changed files with 2 additions and 6 deletions

View File

@ -221,12 +221,8 @@ QT_END_NAMESPACE
const QWindowList topLevels = QGuiApplication::topLevelWindows();
for (int i = 0; i < topLevels.size(); ++i) {
QWindow *topLevelWindow = topLevels.at(i);
// Widgets have alreay received a CloseEvent from the QApplication
// QCloseEvent handler. (see canQuit above). Prevent running the
// CloseEvent logic twice, call close() directly.
if (topLevelWindow->inherits("QWidgetWindow"))
topLevelWindow->close();
else
// Already closed windows will not have a platform window, skip those
if (topLevelWindow->handle())
QWindowSystemInterface::handleCloseEvent(topLevelWindow);
}
QWindowSystemInterface::flushWindowSystemEvents();