summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2017-08-28 14:50:25 +0200
committerEike Ziller <eike.ziller@qt.io>2017-08-28 13:44:49 +0000
commit5cf580c1f3ae2426e716f77a9a69187609beb968 (patch)
treed8c5d027d345fca674b02a8278cf87e39f49754a
parent410e78e4fdfa46ecd7626284b343fbbaccc19fa2 (diff)
downloadqt-creator-5cf580c1f3ae2426e716f77a9a69187609beb968.tar.gz
macOS: Fix issue with saving settings (work around Qt bug)
When closing the application via Quit from the application's context menu in the dock, Qt sends the closeEvent twice, leading to funny issues (QTBUG-43344). Remember if we already successfully went through the closeEvent, and skip it in that case. Task-number: QTCREATORBUG-18798 Change-Id: I8c54f0695b1af2572fa0ade7487a6a993022946b Reviewed-by: Christian Stenger <christian.stenger@qt.io>
-rw-r--r--src/plugins/coreplugin/mainwindow.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp
index 17fed47e85..9010fd8da3 100644
--- a/src/plugins/coreplugin/mainwindow.cpp
+++ b/src/plugins/coreplugin/mainwindow.cpp
@@ -355,6 +355,13 @@ void MainWindow::extensionsInitialized()
void MainWindow::closeEvent(QCloseEvent *event)
{
+ // work around QTBUG-43344
+ static bool alreadyClosed = false;
+ if (alreadyClosed) {
+ event->accept();
+ return;
+ }
+
ICore::saveSettings();
// Save opened files
@@ -378,6 +385,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
m_rightNavigationWidget->closeSubWidgets();
event->accept();
+ alreadyClosed = true;
}
void MainWindow::openDroppedFiles(const QList<DropSupport::FileSpec> &files)