dbus/python dbus_bindings.pyx,1.2,1.3 proxies.py,1.7,1.8
John Palmieri
johnp at freedesktop.org
Thu Aug 25 20:10:01 PDT 2005
Update of /cvs/dbus/dbus/python
In directory gabe:/tmp/cvs-serv28598/python
Modified Files:
dbus_bindings.pyx proxies.py
Log Message:
* python/dbus_bindings.pyx: Tracked down a major memleak and fixed it
(EmptyMessage): new class that subclasses Message. This is a workaround
to a Pyrex bug that fails to call __del__ when the Message object goes out
of scope. For some reason subclassing Message fixes this bug
(Bus::send_with_reply_and_block): use EmptyMessage instead of Message
Index: dbus_bindings.pyx
===================================================================
RCS file: /cvs/dbus/dbus/python/dbus_bindings.pyx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- dbus_bindings.pyx 16 Aug 2005 22:54:04 -0000 1.2
+++ dbus_bindings.pyx 26 Aug 2005 03:09:59 -0000 1.3
@@ -359,7 +359,7 @@
return (retval, pending_call)
def send_with_reply_and_block(self, Message message,
- timeout_milliseconds=0):
+ timeout_milliseconds=-1):
cdef DBusMessage * retval
cdef DBusError error
cdef DBusMessage *msg
@@ -381,9 +381,10 @@
if retval == NULL:
raise AssertionError
- m = Message(_create=0)
+ m = EmptyMessage()
m._set_msg(retval)
- return m
+
+ return m
def set_watch_functions(self, add_function, remove_function, data):
pass
@@ -1255,19 +1256,18 @@
if (service != None):
cservice = service
- if not _create:
- return
-
- if message_type == MESSAGE_TYPE_METHOD_CALL:
- self.msg = dbus_message_new_method_call(cservice, path, ciface, method)
- elif message_type == MESSAGE_TYPE_METHOD_RETURN:
- cmsg = method_call._get_msg()
- self.msg = dbus_message_new_method_return(cmsg)
- elif message_type == MESSAGE_TYPE_SIGNAL:
- self.msg = dbus_message_new_signal(path, ciface, name)
- elif message_type == MESSAGE_TYPE_ERROR:
- cmsg = reply_to._get_msg()
- self.msg = dbus_message_new_error(cmsg, error_name, error_message)
+ if _create:
+ if message_type == MESSAGE_TYPE_METHOD_CALL:
+ self.msg = dbus_message_new_method_call(cservice, path, ciface, method)
+ elif message_type == MESSAGE_TYPE_METHOD_RETURN:
+ cmsg = method_call._get_msg()
+ self.msg = dbus_message_new_method_return(cmsg)
+ elif message_type == MESSAGE_TYPE_SIGNAL:
+ self.msg = dbus_message_new_signal(path, ciface, name)
+ elif message_type == MESSAGE_TYPE_ERROR:
+ cmsg = reply_to._get_msg()
+ self.msg = dbus_message_new_error(cmsg, error_name, error_message)
+
def __del__(self):
if self.msg != NULL:
@@ -1439,6 +1439,10 @@
def __init__(self, spath, sinterface, sname):
Message.__init__(self, MESSAGE_TYPE_SIGNAL, path=spath, dbus_interface=sinterface, name=sname)
+class EmptyMessage(Message):
+ def __init__(self):
+ Message.__init__(self, _create=False)
+
class MethodCall(Message):
def __init__(self, mpath, minterface, mmethod):
Message.__init__(self, MESSAGE_TYPE_METHOD_CALL, path=mpath, dbus_interface=minterface, method=mmethod)
Index: proxies.py
===================================================================
RCS file: /cvs/dbus/dbus/python/proxies.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- proxies.py 24 Aug 2005 19:58:32 -0000 1.7
+++ proxies.py 26 Aug 2005 03:09:59 -0000 1.8
@@ -63,7 +63,7 @@
else:
reply_message = self._connection.send_with_reply_and_block(message, timeout)
args_tuple = reply_message.get_args_list()
-
+
if len(args_tuple) == 0:
return
elif len(args_tuple) == 1:
More information about the dbus-commit
mailing list