From 2d6f9b6148a9aa9937c293212e6e7c454cc022a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 11 Sep 2015 13:05:17 +0200 Subject: [PATCH] Cocoa: Don't send duplicate close events. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ø --- src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm index cac50825af..caa8884661 100644 --- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm @@ -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();