From: Huang Peng Date: Sat, 30 Aug 2008 00:53:46 +0000 (+0800) Subject: Fix segfault when connection is broken. X-Git-Tag: 0.1.1.20080830~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7e095605e42a5a614fcfb1c0d34bebcb40222ec6;p=platform%2Fupstream%2Fibus.git Fix segfault when connection is broken. --- 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!");