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
wilder-5.17
Aleix Pol 7 years ago
parent 9fa4d9417c
commit 8e61f49cc2
  1. 7
      shell/main.cpp

@ -42,6 +42,7 @@
#include "softwarerendernotifier.h"
#include <QDir>
#include <QDBusConnectionInterface>
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

Loading…
Cancel
Save