Skip to contentSkip to conversation

Fix bluez-gnome crash on input CreateDevice failure

PATCH New David Woodhouse 1 participant 1 message Sep 22, 2007 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix bluez-gnome crash on input CreateDevice failure

When we try to add an input device which already exists, the bluetooth-properties applet crashes with a dbus error.

This gives a slightly nicer failure mode...

properties/input.c +11 -1
index 7a024ae..4142df5 100644
@@ -56,10 +58,11 @@ static void proxy_callback(DBusGProxy *proxy,
 	const char *path, *busname;
 	const char *adapter = NULL, *address = NULL, *name = NULL;
 	gchar *text;
+	GError *error = NULL;
 
 	g_object_set_data(G_OBJECT(notebook), "call", NULL);
 
-	dbus_g_proxy_end_call(proxy, call, NULL,
+	dbus_g_proxy_end_call(proxy, call, &error,
 				G_TYPE_STRING, &path, G_TYPE_INVALID);
 
 	button = g_object_get_data(G_OBJECT(notebook), "cancel");
@@ -68,6 +71,15 @@ static void proxy_callback(DBusGProxy *proxy,
 	button = g_object_get_data(G_OBJECT(notebook), "close");
 	gtk_widget_set_sensitive(button, TRUE);
 
+	if (error) {
+		label = g_object_get_data(G_OBJECT(notebook), "label");
+		text = g_strdup_printf("<b>%s: %s</b>",
+				       _("Connection failed"), error->message);
+		gtk_label_set_markup(GTK_LABEL(label), text);
+		g_free(text);
+		return;
+	}
+
 	busname = dbus_g_proxy_get_bus_name(proxy);
 
 	client = dbus_g_proxy_new_for_name(connection, busname,
Signature · 11 lines
dwmw2


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel