Paste P486

Masterwork From Distant Lands
ActivePublic

Authored by davidedmundson on Oct 31 2019, 10:23 AM.
From 570bc489b91c66dd7f6b11e184a306d34bb8c1b3 Mon Sep 17 00:00:00 2001
From: David Edmundson <kde@davidedmundson.co.uk>
Date: Thu, 31 Oct 2019 00:18:23 +0000
Subject: [PATCH] Register queued base service name multiple DBus registrations
i.e if we run kate we will register both
org.kde.kate
and org.kde.kate-132234
If this happens multiple times the second instance is queued, meaning it
takes the name org.kde.kate atomically when the first instance quits.
---
src/kdbusservice.cpp | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/kdbusservice.cpp b/src/kdbusservice.cpp
index d5a2cad..d8292b4 100644
--- a/src/kdbusservice.cpp
+++ b/src/kdbusservice.cpp
@@ -168,6 +168,11 @@ public:
auto queueOption = QDBusConnectionInterface::DontQueueService;
+ if (options & KDBusService::Multiple) {
+ // register and queue the bus name, but if it's registered to something else, wait
+ bus->registerService(d->generateServiceName(), QDBusConnectionInterface::QueueService);
+ }
+
if (options & KDBusService::Unique) {
// When a process crashes and gets auto-restarted by KCrash we may
// be in this code path "too early". There is a bit of a delay
@@ -189,6 +194,7 @@ public:
});
}
+ // the proper registration
d->registered =
(bus->registerService(d->serviceName, queueOption) == QDBusConnectionInterface::ServiceRegistered);
--
2.23.0
davidedmundson edited the content of this paste. (Show Details)Oct 31 2019, 10:23 AM
davidedmundson changed the title of this paste from untitled to Masterwork From Distant Lands.