From d223e23291b79e1f3efe1622c9287ee3a3104825 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Fri, 26 May 2017 15:07:06 +0300 Subject: [PATCH] protect from closing on changing sessions --disable quiting the app when there are no windows shown. There are cases that between states some windows may not exist. E.g. when changing sessions and when activating/deactivating screens --- app/main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/main.cpp b/app/main.cpp index cf8890c77..fd139e113 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -66,6 +66,8 @@ int main(int argc, char **argv) QApplication app(argc, argv); KLocalizedString::setApplicationDomain("latte-dock"); app.setWindowIcon(QIcon::fromTheme(QStringLiteral("latte-dock"))); + //protect from closing app when changing to "alternative session" and back + app.setQuitOnLastWindowClosed(false); configureAboutData(); @@ -86,8 +88,10 @@ int main(int argc, char **argv) QLockFile lockFile {QDir::tempPath() + "/latte-dock.lock"}; int timeout {100}; + if (parser.isSet(QStringLiteral("replace")) || parser.isSet(QStringLiteral("import"))) { - qint64 pid{-1}; + qint64 pid{ -1}; + if (lockFile.getLockInfo(&pid, nullptr, nullptr)) { kill(static_cast(pid), SIGINT); timeout = 3000;