Fix segfault when connection is broken.
authorHuang Peng <shawn.p.huang@gmail.com>
Sat, 30 Aug 2008 00:53:46 +0000 (08:53 +0800)
committerHuang Peng <shawn.p.huang@gmail.com>
Sat, 30 Aug 2008 00:53:46 +0000 (08:53 +0800)
lib/gtk2/ibusimclient.c

index 1287aa5..05975bf 100644 (file)
@@ -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!");