emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-29 df094dd4bc1: Do not unregister a D-Bus service which is a uniqu


From: Michael Albinus
Subject: emacs-29 df094dd4bc1: Do not unregister a D-Bus service which is a unique name
Date: Fri, 24 Nov 2023 05:09:28 -0500 (EST)

branch: emacs-29
commit df094dd4bc122d0d1539ee01130dd2b4ed006549
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Do not unregister a D-Bus service which is a unique name
    
    * lisp/net/dbus.el (dbus-unregister-service): Check, whether
    SERVICE is a known name.  (Bug#67386)
---
 lisp/net/dbus.el | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el
index f35d11db152..95f92cf7786 100644
--- a/lisp/net/dbus.el
+++ b/lisp/net/dbus.el
@@ -682,7 +682,9 @@ operation.  One of the following keywords is returned:
 `:non-existent': Service name does not exist on this bus.
 
 `:not-owner': We are neither the primary owner nor waiting in the
-queue of this service."
+queue of this service.
+
+When SERVICE is not a known name but a unique name, the function returns nil."
 
   (maphash
    (lambda (key value)
@@ -694,14 +696,17 @@ queue of this service."
                 (puthash key (delete elt value) dbus-registered-objects-table)
               (remhash key dbus-registered-objects-table)))))))
    dbus-registered-objects-table)
-  (let ((reply (dbus-call-method
-               bus dbus-service-dbus dbus-path-dbus dbus-interface-dbus
-               "ReleaseName" service)))
-    (pcase reply
-      (1 :released)
-      (2 :non-existent)
-      (3 :not-owner)
-      (_ (signal 'dbus-error (list "Could not unregister service" service))))))
+
+  (unless (string-prefix-p ":" service)
+    (let ((reply (dbus-call-method
+                 bus dbus-service-dbus dbus-path-dbus dbus-interface-dbus
+                 "ReleaseName" service)))
+      (pcase reply
+        (1 :released)
+        (2 :non-existent)
+        (3 :not-owner)
+        (_ (signal
+            'dbus-error (list "Could not unregister service" service)))))))
 
 (defun dbus-register-signal
   (bus service path interface signal handler &rest args)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]