diff options
author | Morten Johan Sørvig <morten.sorvig@digia.com> | 2014-06-07 23:34:45 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-06-10 06:54:11 +0200 |
commit | 360fd4a278a8827d9727b295a753e623502c7445 (patch) | |
tree | 7f6f0496b90b502fe07aa736f2927029083d6176 /src/plugins/platforms/cocoa | |
parent | 29513210dfaf4252c67d7142737e41491297911d (diff) |
Cocoa: Don't send duplicate close events.
Don't send QCloseEvents to QWidgetWindows during
cmd-q application shutdown, since widgets will
will already have received close events from
QApplication close event handling.
Task-number: QTBUG-39398
Change-Id: I7f6e892b0042361bed7a3bc5fac8518eabfc8e4e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm | 9 |
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(); |