diff options
author | Colin Walters <walters@verbum.org> | 2008-05-27 18:18:49 (GMT) |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2008-05-27 18:18:49 (GMT) |
commit | ad35bf13f93d18b0b0e8f930ff79af9dcc1c8508 (patch) | |
tree | 35c3c8a6744e77ebb0137c0aa8dcb4ae545ecf54 | |
parent | f110cd3aa0532ab6cdfb1ee9a19f839700fe32e6 (diff) | |
download | dbus-glib-ad35bf13f93d18b0b0e8f930ff79af9dcc1c8508.tar.gz dbus-glib-ad35bf13f93d18b0b0e8f930ff79af9dcc1c8508.tar.xz |
Bug 12675: Handle disconnected connections in calls (Kimmo Hämäläinen)
-rw-r--r-- | dbus/dbus-gproxy.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/dbus/dbus-gproxy.c b/dbus/dbus-gproxy.c index f2f723a..6945616 100644 --- a/dbus/dbus-gproxy.c +++ b/dbus/dbus-gproxy.c @@ -2171,7 +2171,13 @@ dbus_g_proxy_begin_call_internal (DBusGProxy *proxy, timeout)) goto oom; dbus_message_unref (message); - g_assert (pending != NULL); + + /* If we got a NULL pending, that means the connection was disconnected, + * and we need to abort this call. + * https://bugs.freedesktop.org/show_bug.cgi?id=12675 + */ + if (pending == NULL) + return 0; call_id = ++priv->call_id_counter; @@ -2534,8 +2540,18 @@ dbus_g_proxy_call (DBusGProxy *proxy, g_value_array_free (in_args); - first_arg_type = va_arg (args, GType); - ret = dbus_g_proxy_end_call_internal (proxy, call_id, error, first_arg_type, args); + if (call_id > 0) + { + first_arg_type = va_arg (args, GType); + ret = dbus_g_proxy_end_call_internal (proxy, call_id, error, first_arg_type, args); + } + else + { + g_set_error (error, DBUS_GERROR, + DBUS_GERROR_FAILED, + _("Disconnection or out-of-memory")); + ret = FALSE; + } va_end (args); |