summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
index 548c6a23f0..f89439734f 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
+++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
@@ -223,7 +223,14 @@ static void cleanupCocoaApplicationDelegate()
// events while the event loop is still running.
const QWindowList topLevels = QGuiApplication::topLevelWindows();
for (int i = 0; i < topLevels.size(); ++i) {
- QWindowSystemInterface::handleCloseEvent(topLevels.at(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
+ QWindowSystemInterface::handleCloseEvent(topLevelWindow);
}
QWindowSystemInterface::flushWindowSystemEvents();