emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/net/dbus.el,v


From: Michael Albinus
Subject: [Emacs-diffs] Changes to emacs/lisp/net/dbus.el,v
Date: Sun, 30 Dec 2007 15:51:18 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Michael Albinus <albinus>       07/12/30 15:51:18

Index: net/dbus.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/dbus.el,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- net/dbus.el 16 Dec 2007 22:42:47 -0000      1.7
+++ net/dbus.el 30 Dec 2007 15:51:18 -0000      1.8
@@ -64,17 +64,27 @@
      dbus-registered-functions-table)
     result))
 
-(defun dbus-name-owner-changed-handler (service old-owner new-owner)
+(defun dbus-name-owner-changed-handler (&rest args)
   "Reapplies all signal registrations to D-Bus.
 This handler is applied when a \"NameOwnerChanged\" signal has
 arrived.  SERVICE is the object name for which the name owner has
 been changed.  OLD-OWNER is the previous owner of SERVICE, or the
 empty string if SERVICE was not owned yet.  NEW-OWNER is the new
-owner of SERVICE, or the empty string if SERVICE looses any name owner."
+owner of SERVICE, or the empty string if SERVICE looses any name owner.
+
+usage: (dbus-name-owner-changed-handler service old-owner new-owner)"
   (save-match-data
+    ;; Check the arguments.  We should silently ignore it when they
+    ;; are wrong.
+    (if (and (= (length args) 3)
+            (stringp (car args))
+            (stringp (cadr args))
+            (stringp (caddr args)))
+       (let ((service (car args))
+             (old-owner (cadr args))
+             (new-owner (caddr args)))
     ;; Check whether SERVICE is a known name.
-    (when (and (stringp service) (not (string-match "^:" service))
-              (stringp old-owner) (stringp new-owner))
+         (when (not (string-match "^:" service))
       (maphash
        '(lambda (key value)
          (dolist (elt value)
@@ -90,7 +100,14 @@
               (nth 0 key) (nth 1 elt) (nth 2 elt)
               ;; INTERFACE SIGNAL     HANDLER
               (nth 1 key) (nth 2 key) (nth 3 elt)))))
-       (copy-hash-table dbus-registered-functions-table)))))
+            (copy-hash-table dbus-registered-functions-table))))
+      ;; The error is reported only in debug mode.
+      (when  dbus-debug
+       (signal
+        'dbus-error
+        (cons
+         (format "Wrong arguments of %s.NameOwnerChanged" dbus-interface-dbus)
+         args))))))
 
 ;; Register the handler.
 (condition-case nil
@@ -148,11 +165,11 @@
   (interactive "e")
   ;; We don't want to raise an error, because this function is called
   ;; in the event handling loop.
-  (condition-case nil
+  (condition-case err
       (progn
        (dbus-check-event event)
        (apply (nth 6 event) (nthcdr 7 event)))
-    (dbus-error)))
+    (dbus-error (when dbus-debug (signal (car err) (cdr err))))))
 
 (defun dbus-event-bus-name (event)
   "Return the bus name the event is coming from.




reply via email to

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