[patch][python] Survive being kicked off the bus during a method
call
Simon McVittie
simon.mcvittie at collabora.co.uk
Wed Feb 21 07:51:21 PST 2007
This causes the crash Erich Schubert reported to "only" raise
DBusException when we try to introspect /org/freedesktop/DBus/Local,
rather than carrying on regardless with a NULL PendingCall.
>From f1e0a64b9f02a77cfd468f146ed3f398b2c1c8bc Mon Sep 17 00:00:00 2001
From: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date: Wed, 21 Feb 2007 15:04:20 +0000
Subject: [PATCH] If send_with_reply() returns TRUE but with pending call NULL, cope gracefully.
This is a workaround for the fact that trying to use the object path
/org/freedesktop/DBus/Local in a message header (e.g. when introspecting
trackerd with dbus-inspector) causes us to be disconnected by the bus daemon.
---
_dbus_bindings/conn-methods.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/_dbus_bindings/conn-methods.c b/_dbus_bindings/conn-methods.c
index dae1816..d4d031b 100644
--- a/_dbus_bindings/conn-methods.c
+++ b/_dbus_bindings/conn-methods.c
@@ -403,6 +403,13 @@ Connection_send_message_with_reply(Connection *self, PyObject *args, PyObject *k
return PyErr_NoMemory();
}
+ if (!pending) {
+ /* connection is disconnected (doesn't return FALSE!) */
+ PyErr_SetString (DBusPyException, "Connection is disconnected - "
+ "unable to make method call");
+ return NULL;
+ }
+
return DBusPyPendingCall_ConsumeDBusPendingCall(pending, callable);
}
--
1.4.4.4
More information about the dbus
mailing list