diff --git a/kate/main.cpp b/kate/main.cpp --- a/kate/main.cpp +++ b/kate/main.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include "../urlinfo.h" @@ -488,6 +489,17 @@ // make the world happy, we are started, kind of... KStartupInfo::appStarted(); + // We don't want the session manager to restart us on next login + // if we block + if (needToBlock) { + QObject::connect(qApp, &QGuiApplication::saveStateRequest, qApp, + [](QSessionManager &session) { + session.setRestartHint(QSessionManager::RestartNever); + }, + Qt::DirectConnection + ); + } + // this will wait until exiting is emitted by the used instance, if wanted... return needToBlock ? app.exec() : 0; }