From eee401946bf6245b2334164dfb47008f6ba49c26 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Sat, 30 May 2020 19:42:07 +0200 Subject: [PATCH] Don't attach to another instance if we're going to exit It's rude to exit someone else we just attached to BUGS: 419982 --- shell/okular_main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/shell/okular_main.cpp b/shell/okular_main.cpp index 050d143f2..41cddc29f 100644 --- a/shell/okular_main.cpp +++ b/shell/okular_main.cpp @@ -47,6 +47,11 @@ static bool attachExistingInstance(const QStringList &paths, const QString &seri if ( paths.count() < 1 ) return false; + // Don't try to attach to an existing instance with --print-and-exit because that would mean + // we're going to exit that other instance and that's just rude + if ( ShellUtils::showPrintDialogAndExit(serializedOptions) ) + return false; + const QStringList services = QDBusConnection::sessionBus().interface()->registeredServiceNames().value(); // Don't match the service without trailing "-" (unique instance)