From c6e759003465bfa8b5193af3d49b0b0276615904 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 3 Apr 2018 17:41:39 +0300 Subject: [PATCH] Fix MacOS regression QWidget::closeEvent called twice. --HG-- branch : develop --- src/app/tape/tmainwindow.cpp | 9 +++++++++ src/app/valentina/mainwindow.cpp | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index 223899ddd..bec1fb139 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -519,6 +519,15 @@ void TMainWindow::ToolBarStyles() //--------------------------------------------------------------------------------------------------------------------- void TMainWindow::closeEvent(QCloseEvent *event) { +#if defined(Q_OS_MAC) + // Workaround for Qt bug https://bugreports.qt.io/browse/QTBUG-43344 + static int numCalled = 0; + if (numCalled++ >= 1) + { + return; + } +#endif + if (MaybeSave()) { WriteSettings(); diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index caf47fbd4..90ce9ca13 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -1508,6 +1508,15 @@ void MainWindow::changeEvent(QEvent *event) */ void MainWindow::closeEvent(QCloseEvent *event) { +#if defined(Q_OS_MAC) + // Workaround for Qt bug https://bugreports.qt.io/browse/QTBUG-43344 + static int numCalled = 0; + if (numCalled++ >= 1) + { + return; + } +#endif + qCDebug(vMainWindow, "Closing main window"); if (MaybeSave()) {