diff options
| author | Michael Albinus | 2011-09-24 13:45:13 +0200 |
|---|---|---|
| committer | Michael Albinus | 2011-09-24 13:45:13 +0200 |
| commit | fac7ae53a7832a967e351c6dbfa5552bb313d4bc (patch) | |
| tree | a3768f26a57de723857689cbb6fa4be6420893cb | |
| parent | a3de0cbd6de04250fb1a55d27bb1a1b7e61f31f1 (diff) | |
| download | emacs-fac7ae53a7832a967e351c6dbfa5552bb313d4bc.tar.gz emacs-fac7ae53a7832a967e351c6dbfa5552bb313d4bc.zip | |
* net/dbus.el (dbus-unregister-object): Remove match rule of signals.
Release services only if they are defined. (Bug#9581)
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/net/dbus.el | 33 |
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 @@ | |||
| 1 | 2011-09-24 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * net/dbus.el (dbus-unregister-object): Remove match rule of signals. | ||
| 4 | Release services only if they are defined. (Bug#9581) | ||
| 5 | |||
| 1 | 2011-09-23 Richard Stallman <rms@gnu.org> | 6 | 2011-09-23 Richard Stallman <rms@gnu.org> |
| 2 | 7 | ||
| 3 | * textmodes/paragraphs.el (forward-sentence): For backwards case, | 8 | * 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." | |||
| 143 | (value (cdr object)) | 143 | (value (cdr object)) |
| 144 | (entry (gethash key dbus-registered-objects-table)) | 144 | (entry (gethash key dbus-registered-objects-table)) |
| 145 | ret) | 145 | ret) |
| 146 | ;; entry has the structure ((UNAME SERVICE PATH MEMBER) ...). | 146 | ;; entry has the structure ((UNAME SERVICE PATH MEMBER [RULE]) ...). |
| 147 | ;; value has the structure ((SERVICE PATH [HANDLER]) ...). | 147 | ;; value has the structure ((SERVICE PATH [HANDLER]) ...). |
| 148 | ;; MEMBER is either a string (the handler), or a cons cell (a | 148 | ;; MEMBER is either a string (the handler), or a cons cell (a |
| 149 | ;; property value). UNAME and property values are not taken into | 149 | ;; property value). UNAME and property values are not taken into |
| @@ -154,11 +154,17 @@ association to the service from D-Bus." | |||
| 154 | (when (equal | 154 | (when (equal |
| 155 | (car value) | 155 | (car value) |
| 156 | (butlast (cdr elt) (- (length (cdr elt)) (length (car value))))) | 156 | (butlast (cdr elt) (- (length (cdr elt)) (length (car value))))) |
| 157 | (setq ret t) | ||
| 157 | ;; Compute new hash value. If it is empty, remove it from the | 158 | ;; Compute new hash value. If it is empty, remove it from the |
| 158 | ;; hash table. | 159 | ;; hash table. |
| 159 | (unless (puthash key (delete elt entry) dbus-registered-objects-table) | 160 | (unless (puthash key (delete elt entry) dbus-registered-objects-table) |
| 160 | (remhash key dbus-registered-objects-table)) | 161 | (remhash key dbus-registered-objects-table)) |
| 161 | (setq ret t))) | 162 | ;; Remove match rule of signals. |
| 163 | (let ((rule (nth 4 elt))) | ||
| 164 | (when (stringp rule) | ||
| 165 | (dbus-call-method | ||
| 166 | (car key) dbus-service-dbus dbus-path-dbus dbus-interface-dbus | ||
| 167 | "RemoveMatch" rule))))) | ||
| 162 | ;; Check, whether there is still a registered function or property | 168 | ;; Check, whether there is still a registered function or property |
| 163 | ;; for the given service. If not, unregister the service from the | 169 | ;; for the given service. If not, unregister the service from the |
| 164 | ;; bus. | 170 | ;; bus. |
| @@ -166,17 +172,18 @@ association to the service from D-Bus." | |||
| 166 | (let ((service (cadr elt)) | 172 | (let ((service (cadr elt)) |
| 167 | (bus (car key)) | 173 | (bus (car key)) |
| 168 | found) | 174 | found) |
| 169 | (maphash | 175 | (when service |
| 170 | (lambda (k v) | 176 | (maphash |
| 171 | (dolist (e v) | 177 | (lambda (k v) |
| 172 | (ignore-errors | 178 | (dolist (e v) |
| 173 | (when (and (equal bus (car k)) (string-equal service (cadr e))) | 179 | (ignore-errors |
| 174 | (setq found t))))) | 180 | (when (and (equal bus (car k)) (string-equal service (cadr e))) |
| 175 | dbus-registered-objects-table) | 181 | (setq found t))))) |
| 176 | (unless found | 182 | dbus-registered-objects-table) |
| 177 | (dbus-call-method | 183 | (unless found |
| 178 | bus dbus-service-dbus dbus-path-dbus dbus-interface-dbus | 184 | (dbus-call-method |
| 179 | "ReleaseName" service)))) | 185 | bus dbus-service-dbus dbus-path-dbus dbus-interface-dbus |
| 186 | "ReleaseName" service))))) | ||
| 180 | ;; Return. | 187 | ;; Return. |
| 181 | ret)) | 188 | ret)) |
| 182 | 189 | ||