mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-06-04 19:08:16 +02:00
* 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
This commit is contained in:
parent
c2ff73e5c6
commit
64e468d21c
3 changed files with 29 additions and 17 deletions
|
|
@ -1,3 +1,11 @@
|
|||
2005-08-25 John (J5) Palmieri <johnp@redhat.com>
|
||||
|
||||
* 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
|
||||
|
||||
2005-08-25 Colin Walters <walters@verbum.org>
|
||||
|
||||
* glib/dbus-gproxy.c (dbus_g_proxy_call): Doc update, thanks
|
||||
|
|
|
|||
|
|
@ -359,7 +359,7 @@ cdef class Connection:
|
|||
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 @@ cdef class Connection:
|
|||
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 @@ cdef class Message:
|
|||
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 @@ class Signal(Message):
|
|||
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)
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class ProxyMethod:
|
|||
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:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue