From 7e095605e42a5a614fcfb1c0d34bebcb40222ec6 Mon Sep 17 00:00:00 2001 From: Huang Peng Date: Sat, 30 Aug 2008 08:53:46 +0800 Subject: [PATCH] Fix segfault when connection is broken. --- lib/gtk2/ibusimclient.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/gtk2/ibusimclient.c b/lib/gtk2/ibusimclient.c index 1287aa5..05975bf 100644 --- a/lib/gtk2/ibusimclient.c +++ b/lib/gtk2/ibusimclient.c @@ -1208,7 +1208,7 @@ _dbus_call_with_reply_valist (DBusConnection *connection, } if (!dbus_message_append_args_valist (message, first_arg_type, args)) { - g_warning ("Can not create call message"); + g_warning ("Can not create call message!"); goto error; } @@ -1218,6 +1218,15 @@ _dbus_call_with_reply_valist (DBusConnection *connection, goto error; } + /* If we got a NULL pending, that means the connection was disconnected, + * and we need to aboout this call + * https://bugs.freedesktop.org/show_bug.cgi?id=12675 + */ + if (pendingcall == 0) { + g_warning ("Connection is breaken!"); + goto error; + } + if (!dbus_pending_call_set_notify (pendingcall, notify_function, user_data, free_function)) { g_warning ("Out of memory!"); -- 2.7.4