| Summary: | Kate clears sessions upon close | ||
|---|---|---|---|
| Product: | [Applications] kate | Reporter: | Christopher Jacobs <MrChristopherJacobs> |
| Component: | sessions | Assignee: | KWrite Developers <kwrite-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | christoph, felim, michaelalexsander |
| Priority: | NOR | ||
| Version First Reported In: | 22.12.3 | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | https://invent.kde.org/utilities/kate/-/commit/f459fc544c31efbee9645612ee517f73a2808886 | Version Fixed/Implemented In: | 23.08.0 |
| Sentry Crash Report: | |||
|
Description
Christopher Jacobs
2023-05-26 14:32:38 UTC
*** Bug 472510 has been marked as a duplicate of this bug. *** I think we did break the logic for that with the current code in
/**
* queryClose(), take care that after the last mainwindow the stuff is closed
*/
bool KateMainWindow::queryClose()
{
// session saving, can we close all views ?
// just test, not close them actually
if (qApp->isSavingSession()) {
return queryClose_internal();
}
// normal closing of window
// if we are not the last window, just close the documents we own
if (KateApp::self()->mainWindowsCount() > 1) {
return winClosesDocuments() ? queryClose_internal(nullptr, this) : true;
}
// last one: check if we can close all documents, try run
// and save docs if we really close down !
if (queryClose_internal()) {
KateApp::self()->sessionManager()->saveActiveSession(true);
KateApp::self()->stashManager()->stashDocuments(KateApp::self()->sessionManager()->activeSession()->config(),
KateApp::self()->documentManager()->documentList());
return true;
}
return false;
}
Hmmm, or the session save timer does that on shutdown.
void KateSessionManager::initTimer()
{
if (m_sessionSaveTimer) {
qWarning() << "Session save timer is already initalized! should not happen";
return;
}
m_sessionSaveTimer = std::make_unique<QTimer>();
m_sessionSaveTimer->setInterval(5000);
m_sessionSaveTimer->setSingleShot(true);
auto *t = m_sessionSaveTimer.get();
auto dm = KateApp::self()->documentManager();
auto startTimer = [t] {
if (!t->isActive()) {
t->start();
}
};
connect(dm, &KateDocManager::documentCreated, t, startTimer);
connect(dm, &KateDocManager::documentDeleted, t, startTimer);
m_sessionSaveTimer->callOnTimeout(this, [this] {
saveActiveSession(true);
});
}
A possibly relevant merge request was started @ https://invent.kde.org/utilities/kate/-/merge_requests/1272 If somebody could test my patch that would be awesome. Git commit 772450c9fb3217373ab3d279dfc5df0b4c741d3c by Christoph Cullmann. Committed on 01/08/2023 at 19:33. Pushed by cullmann into branch 'master'. avoid that the session save timer messes up session saving we need to ensure it doesn't trigger during window/app closing M +3 -0 apps/lib/kateapp.cpp M +6 -0 apps/lib/katemainwindow.cpp M +19 -28 apps/lib/session/katesessionmanager.cpp M +40 -3 apps/lib/session/katesessionmanager.h https://invent.kde.org/utilities/kate/-/commit/772450c9fb3217373ab3d279dfc5df0b4c741d3c Git commit f459fc544c31efbee9645612ee517f73a2808886 by Christoph Cullmann. Committed on 02/08/2023 at 21:20. Pushed by cullmann into branch 'release/23.08'. avoid that the session save timer messes up session saving we need to ensure it doesn't trigger during window/app closing (cherry picked from commit 772450c9fb3217373ab3d279dfc5df0b4c741d3c) M +3 -0 apps/lib/kateapp.cpp M +6 -0 apps/lib/katemainwindow.cpp M +19 -28 apps/lib/session/katesessionmanager.cpp M +40 -3 apps/lib/session/katesessionmanager.h https://invent.kde.org/utilities/kate/-/commit/f459fc544c31efbee9645612ee517f73a2808886 I hope this is fixed, if somebody can confirm with a master build that would be great. *** Bug 467877 has been marked as a duplicate of this bug. *** This was still an issue up until 24.05.0 so not sure it was the same as the linked bug but it's working now! Thanks! |