[at-spi2-core] Cancel pending calls when giving up on them
- From: Mike Gorse <mgorse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [at-spi2-core] Cancel pending calls when giving up on them
- Date: Wed, 10 Jul 2013 20:24:46 +0000 (UTC)
commit 5c7e53d9924dabf8082fa97b247b1529e2e4e8f5
Author: Mike Gorse <mgorse suse com>
Date: Wed Jul 10 15:20:53 2013 -0500
Cancel pending calls when giving up on them
When timing out without having received a reply from a pending call,
then
cancel the call so that it will be removed from the DBusConnection's
queue. This will hopefully prevent the call and the
SpiReentrantCallClosure from being leaked.
Note that this code is still behaving oddly (why isn't a notification
being sent by libdbus when the specified amount of time has ellapsed?)
dbind/dbind.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/dbind/dbind.c b/dbind/dbind.c
index a463308..b83071a 100644
--- a/dbind/dbind.c
+++ b/dbind/dbind.c
@@ -76,10 +76,12 @@ dbind_send_and_allow_reentry (DBusConnection * bus, DBusMessage * message, DBusE
closure = g_new0 (SpiReentrantCallClosure, 1);
closure->reply = NULL;
atspi_dbus_connection_setup_with_g_main(bus, NULL);
- if (!dbus_connection_send_with_reply (bus, message, &pending, dbind_timeout))
+ if (!dbus_connection_send_with_reply (bus, message, &pending, dbind_timeout)
+ || !pending)
+ {
+ g_free (closure);
return NULL;
- if (!pending)
- return NULL;
+ }
dbus_pending_call_set_notify (pending, set_reply, (void *) closure, g_free);
closure->reply = NULL;
@@ -89,11 +91,15 @@ dbind_send_and_allow_reentry (DBusConnection * bus, DBusMessage * message, DBusE
{
if (!dbus_connection_read_write_dispatch (bus, dbind_timeout))
{
+ //dbus_pending_call_set_notify (pending, NULL, NULL, NULL);
+ dbus_pending_call_cancel (pending);
dbus_pending_call_unref (pending);
return NULL;
}
if (time_elapsed (&tv) > dbind_timeout)
{
+ //dbus_pending_call_set_notify (pending, NULL, NULL, NULL);
+ dbus_pending_call_cancel (pending);
dbus_pending_call_unref (pending);
dbus_set_error_const (error, "org.freedesktop.DBus.Error.NoReply",
"timeout from dbind");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]