On Mac OSX Qt Applications (with Frameworks packaged) receive the
CloseEvent twice. (See https://bugreports.qt.io/browse/QTBUG-43344)
This triggers a bug where Quassels Main-Window stays hidden and all
Layout states get reset on next launch.
Workaround by checking if event already received...
Resolves GH-230.
_titleSetter(this),
_awayLog(0),
_layoutLoaded(false),
_titleSetter(this),
_awayLog(0),
_layoutLoaded(false),
- _activeBufferViewIndex(-1)
+ _activeBufferViewIndex(-1),
+ _aboutToQuit(false)
{
setAttribute(Qt::WA_DeleteOnClose, false); // we delete the mainwin manually
{
setAttribute(Qt::WA_DeleteOnClose, false); // we delete the mainwin manually
QtUiSettings s;
QtUiApplication *app = qobject_cast<QtUiApplication *> qApp;
Q_ASSERT(app);
QtUiSettings s;
QtUiApplication *app = qobject_cast<QtUiApplication *> 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();
}
QtUi::hideMainWidget();
event->ignore();
}
+ else if(!_aboutToQuit) {
+ _aboutToQuit = true;
event->accept();
quit();
}
event->accept();
quit();
}
+ else {
+ event->ignore();
+ }
QHash<int, BufferId> _jumpKeyMap;
int _activeBufferViewIndex;
QHash<int, BufferId> _jumpKeyMap;
int _activeBufferViewIndex;
+ bool _aboutToQuit; //closeEvent can occur multiple times on OSX
+