Commit 18ca6e9c authored by Allan Sandfeld Jensen's avatar Allan Sandfeld Jensen
Browse files

Handle double close in main window

After a bug fix in Qt 5.14 we now get real close events for unclosed windows
when the application closes, so we would be getting two close events breaking
our logic when when to suppress on-close dialogs.

Suppress the real close event after we have handled our own simulated one. Also
works if there is no real close event.

BUG: 416728
parent b0ebb064
......@@ -280,6 +280,7 @@ void KMainWindowPrivate::init(KMainWindow *_q)
letDirtySettings = true;
sizeApplied = false;
suppressCloseEvent = false;
static bool endsWithHashNumber(const QString &s)
......@@ -530,6 +531,10 @@ void KMainWindow::appHelpActivated()
void KMainWindow::closeEvent(QCloseEvent *e)
if (suppressCloseEvent) {
// Save settings if auto-save is enabled, and settings have changed
if (d->settingsTimer && d->settingsTimer->isActive()) {
......@@ -550,6 +555,9 @@ void KMainWindow::closeEvent(QCloseEvent *e)
} else {
e->ignore(); //if the window should not be closed, don't close it
// If saving session, we are processing a fake close event, and might get the real one later.
if (e->isAccepted() && qApp->isSavingSession())
suppressCloseEvent = true;
bool KMainWindow::queryClose()
......@@ -47,6 +47,7 @@ public:
bool settingsDirty: 1;
bool autoSaveWindowSize: 1;
bool sizeApplied: 1;
bool suppressCloseEvent: 1
KConfigGroup autoSaveGroup;
QTimer *settingsTimer;
QTimer *sizeTimer;
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