From f1e0a64b9f02a77cfd468f146ed3f398b2c1c8bc Mon Sep 17 00:00:00 2001 From: Simon McVittie 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 file changed, 7 insertions(+) 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); } -- 2.11.4.GIT