Commit 5cf580c1 authored by Eike Ziller's avatar Eike Ziller

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's avatarChristian Stenger <christian.stenger@qt.io>
parent 410e78e4
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment