X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fmainwin.cpp;h=eb02b43029d17e43c775b87106fe82c6b9ad1199;hp=6e681e445ea6c9b7bc67a035342116d7e4c6d149;hb=89175f57858e885d23dac1401f6f14db20ba9002;hpb=4b3d1dfbdc5a541dbbdd6574e603f4351d8b3274 diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index 6e681e44..eb02b430 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -173,7 +173,8 @@ MainWin::MainWin(QWidget *parent) _titleSetter(this), _awayLog(0), _layoutLoaded(false), - _activeBufferViewIndex(-1) + _activeBufferViewIndex(-1), + _aboutToQuit(false) { setAttribute(Qt::WA_DeleteOnClose, false); // we delete the mainwin manually @@ -1509,14 +1510,21 @@ void MainWin::closeEvent(QCloseEvent *event) QtUiSettings s; QtUiApplication *app = qobject_cast qApp; Q_ASSERT(app); - if (!app->isAboutToQuit() && QtUi::haveSystemTray() && s.value("MinimizeOnClose").toBool()) { + // On OSX it can happen that the closeEvent occurs twice. (Especially if packaged with Frameworks) + // This messes up MainWinState/MainWinHidden save/restore. + // It's a bug in Qt: https://bugreports.qt.io/browse/QTBUG-43344 + if (!_aboutToQuit && !app->isAboutToQuit() && QtUi::haveSystemTray() && s.value("MinimizeOnClose").toBool()) { QtUi::hideMainWidget(); event->ignore(); } - else { + else if(!_aboutToQuit) { + _aboutToQuit = true; event->accept(); quit(); } + else { + event->ignore(); + } }