From 8e61f49cc292c64b2ef6d0859a6d884c8be7fcd0 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Mon, 5 Aug 2019 13:42:06 +0200 Subject: [PATCH] Fix --replace option Summary: Wait for the other process to unregister before starting the new one. Test Plan: Reproduced the problem Noah mentioned and addressed it. Subscribers: ndavis, broulik, plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D22945 --- shell/main.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/shell/main.cpp b/shell/main.cpp index 57e931379..9899d4abd 100644 --- a/shell/main.cpp +++ b/shell/main.cpp @@ -42,6 +42,7 @@ #include "softwarerendernotifier.h" #include +#include int main(int argc, char *argv[]) { @@ -176,7 +177,11 @@ int main(int argc, char *argv[]) QStringLiteral("/MainApplication"), QStringLiteral("org.qtproject.Qt.QCoreApplication"), QStringLiteral("quit")); - QDBusConnection::sessionBus().call(message); //deliberately block until it's done, so we register the name after the app quits + auto reply = QDBusConnection::sessionBus().call(message); //deliberately block until it's done, so we register the name after the app quits + + while (QDBusConnection::sessionBus().interface()->isServiceRegistered(QStringLiteral("org.kde.plasmashell"))) { + QCoreApplication::processEvents(QEventLoop::AllEvents); + } } QObject::connect(corona, &ShellCorona::glInitializationFailed, &app, [&app]() { //scene graphs errors come from a thread