summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2011-09-24 13:45:13 +0200
committerMichael Albinus <michael.albinus@gmx.de>2011-09-24 13:45:13 +0200
commitfac7ae53a7832a967e351c6dbfa5552bb313d4bc (patch)
treea3768f26a57de723857689cbb6fa4be6420893cb
parenta3de0cbd6de04250fb1a55d27bb1a1b7e61f31f1 (diff)
downloademacs-fac7ae53a7832a967e351c6dbfa5552bb313d4bc.tar.gz
* net/dbus.el (dbus-unregister-object): Remove match rule of signals.
Release services only if they are defined. (Bug#9581)
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/net/dbus.el33
2 files changed, 25 insertions, 13 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a7e9afc96c6..6f322d5f3bf 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2011-09-24 Michael Albinus <michael.albinus@gmx.de>
+
+ * net/dbus.el (dbus-unregister-object): Remove match rule of signals.
+ Release services only if they are defined. (Bug#9581)
+
2011-09-23 Richard Stallman <rms@gnu.org>
* textmodes/paragraphs.el (forward-sentence): For backwards case,
diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el
index 87af3d13591..cbf9fe6ed86 100644
--- a/lisp/net/dbus.el
+++ b/lisp/net/dbus.el
@@ -143,7 +143,7 @@ association to the service from D-Bus."
(value (cdr object))
(entry (gethash key dbus-registered-objects-table))
ret)
- ;; entry has the structure ((UNAME SERVICE PATH MEMBER) ...).
+ ;; entry has the structure ((UNAME SERVICE PATH MEMBER [RULE]) ...).
;; value has the structure ((SERVICE PATH [HANDLER]) ...).
;; MEMBER is either a string (the handler), or a cons cell (a
;; property value). UNAME and property values are not taken into
@@ -154,11 +154,17 @@ association to the service from D-Bus."
(when (equal
(car value)
(butlast (cdr elt) (- (length (cdr elt)) (length (car value)))))
+ (setq ret t)
;; Compute new hash value. If it is empty, remove it from the
;; hash table.
(unless (puthash key (delete elt entry) dbus-registered-objects-table)
(remhash key dbus-registered-objects-table))
- (setq ret t)))
+ ;; Remove match rule of signals.
+ (let ((rule (nth 4 elt)))
+ (when (stringp rule)
+ (dbus-call-method
+ (car key) dbus-service-dbus dbus-path-dbus dbus-interface-dbus
+ "RemoveMatch" rule)))))
;; Check, whether there is still a registered function or property
;; for the given service. If not, unregister the service from the
;; bus.
@@ -166,17 +172,18 @@ association to the service from D-Bus."
(let ((service (cadr elt))
(bus (car key))
found)
- (maphash
- (lambda (k v)
- (dolist (e v)
- (ignore-errors
- (when (and (equal bus (car k)) (string-equal service (cadr e)))
- (setq found t)))))
- dbus-registered-objects-table)
- (unless found
- (dbus-call-method
- bus dbus-service-dbus dbus-path-dbus dbus-interface-dbus
- "ReleaseName" service))))
+ (when service
+ (maphash
+ (lambda (k v)
+ (dolist (e v)
+ (ignore-errors
+ (when (and (equal bus (car k)) (string-equal service (cadr e)))
+ (setq found t)))))
+ dbus-registered-objects-table)
+ (unless found
+ (dbus-call-method
+ bus dbus-service-dbus dbus-path-dbus dbus-interface-dbus
+ "ReleaseName" service)))))
;; Return.
ret))