]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
* glib/dbus-gmain.c (io_handler_dispatch): fix deadlock
authorJohn (J5) Palmieri <johnp@redhat.com>
Mon, 16 May 2005 21:27:04 +0000 (21:27 +0000)
committerJohn (J5) Palmieri <johnp@redhat.com>
Mon, 16 May 2005 21:27:04 +0000 (21:27 +0000)
  when using recursive g_main_loops

* python/_dbus.py (class Bus): add the ProxyObjectClass
  alias for ProxyObject to make it easier for the Twisted
  networking framework to integrate dbus.

* python/proxies.py (class ProxyObject): add the ProxyMethodClass
  alias for ProxyMethod to make it easier for the Twisted
  networking framework to integrate dbus.

ChangeLog
glib/dbus-gmain.c
python/_dbus.py
python/proxies.py

index c3c8fafabc6abc6019d024e5112c1302d7b3de8c..bd49566d9231a91e82c91f4dfef67783867229a2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2005-05-16  John (J5) Palmieri  <johnp@redhat.com>
+
+       * glib/dbus-gmain.c (io_handler_dispatch): fix deadlock
+       when using recursive g_main_loops
+
+       * python/_dbus.py (class Bus): add the ProxyObjectClass
+       alias for ProxyObject to make it easier for the Twisted 
+       networking framework to integrate dbus.
+
+       * python/proxies.py (class ProxyObject): add the ProxyMethodClass
+       alias for ProxyMethod to make it easier for the Twisted 
+       networking framework to integrate dbus. 
+
 2005-05-11  Ross Burton  <ross@burtonini.com>
 
        * glib/dbus-glib-tool.c: Add --prefix argument.
index b824f01d635258b11993de237ee9a87462081d76..046c493c0c36f43a281c9318c93935dd7f98765a 100644 (file)
@@ -240,13 +240,7 @@ io_handler_dispatch (GIOChannel   *source,
   handler = NULL;
 
   if (connection)
-    {
-      /* Dispatch messages */
-      while (dbus_connection_dispatch (connection) == DBUS_DISPATCH_DATA_REMAINS)
-        ;
-      
-      dbus_connection_unref (connection);
-    }
+    dbus_connection_unref (connection);
   
   return TRUE;
 }
index d9c81235a136bd51169f3f0cd903dbce2ccb33ea..ca7a156a207d411de074482c1414a391298443da 100644 (file)
@@ -70,6 +70,8 @@ class Bus:
     """bus_type=[Bus.TYPE_SESSION | Bus.TYPE_SYSTEM | Bus.TYPE_STARTER]
     """
 
+    ProxyObjectClass = ProxyObject
+
     START_REPLY_SUCCESS = dbus_bindings.DBUS_START_REPLY_SUCCESS
     START_REPLY_ALREADY_RUNNING = dbus_bindings.DBUS_START_REPLY_ALREADY_RUNNING 
 
@@ -106,7 +108,7 @@ class Bus:
 
     def get_object(self, named_service, object_path):
         """Get a proxy object to call over the bus"""
-        return ProxyObject(self, named_service, object_path)
+        return self.ProxyObjectClass(self, named_service, object_path)
 
     def add_signal_receiver(self, handler_function, signal_name=None, dbus_interface=None, named_service=None, path=None):
         match_rule = self._get_match_rule(signal_name, dbus_interface, named_service, path)
index cbd492003760c16dd4b322c13ba8dee90e794264..688dd8ab8756e115af73bab68ffbf8d64cebd3cf 100644 (file)
@@ -1,45 +1,5 @@
 import dbus_bindings
 
-class ProxyObject:
-    """A proxy to the remote Object.
-
-    A ProxyObject is provided by the Bus. ProxyObjects
-    have member functions, and can be called like normal Python objects.
-    """
-    def __init__(self, bus, named_service, object_path):
-        self._bus          = bus
-        self._named_service = named_service
-        self._object_path  = object_path
-
-    def connect_to_signal(self, signal_name, handler_function, dbus_interface=None):
-        self._bus.add_signal_receiver(handler_function,
-                                      signal_name=signal_name,
-                                      dbus_interface=dbus_interface,
-                                      named_service=self._named_service,
-                                      path=self._object_path)
-
-
-
-    def __getattr__(self, member, **keywords):
-        if member == '__call__':
-            return object.__call__
-        elif member.startswith('__') and member.endswith('__'):
-            raise AttributeError(member)
-        else:
-            iface = None
-            if (keywords.has_key('dbus_interface')):
-                iface = keywords['dbus_interface']
-
-            return ProxyMethod(self._bus.get_connection(),
-                                self._named_service,
-                                self._object_path, iface, member)
-
-    def __repr__(self):
-        return '<ProxyObject wrapping %s %s %s at %x>'%( 
-            self._bus, self._named_service, self._object_path , id(self))
-    __str__ = __repr__
-
-
 class ProxyMethod:
     """A proxy Method.
 
@@ -95,3 +55,45 @@ class ProxyMethod:
         else:
             return args_tuple
 
+
+class ProxyObject:
+    """A proxy to the remote Object.
+
+    A ProxyObject is provided by the Bus. ProxyObjects
+    have member functions, and can be called like normal Python objects.
+    """
+    ProxyMethodClass = ProxyMethod
+
+    def __init__(self, bus, named_service, object_path):
+        self._bus          = bus
+        self._named_service = named_service
+        self._object_path  = object_path
+
+    def connect_to_signal(self, signal_name, handler_function, dbus_interface=None):
+        self._bus.add_signal_receiver(handler_function,
+                                      signal_name=signal_name,
+                                      dbus_interface=dbus_interface,
+                                      named_service=self._named_service,
+                                      path=self._object_path)
+
+
+
+    def __getattr__(self, member, **keywords):
+        if member == '__call__':
+            return object.__call__
+        elif member.startswith('__') and member.endswith('__'):
+            raise AttributeError(member)
+        else:
+            iface = None
+            if (keywords.has_key('dbus_interface')):
+                iface = keywords['dbus_interface']
+
+            return self.ProxyMethodClass(self._bus.get_connection(),
+                                self._named_service,
+                                self._object_path, iface, member)
+
+    def __repr__(self):
+        return '<ProxyObject wrapping %s %s %s at %x>'%( 
+            self._bus, self._named_service, self._object_path , id(self))
+    __str__ = __repr__
+