public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [Bluez-devel] [PATCH] bluez-gnome access volatile while adapter-changed
@ 2008-03-10  6:36 Ming-I Hsieh
  2008-03-10 23:29 ` Bastien Nocera
  0 siblings, 1 reply; 5+ messages in thread
From: Ming-I Hsieh @ 2008-03-10  6:36 UTC (permalink / raw)
  To: bluez devel

[-- Attachment #1: Type: text/plain, Size: 320 bytes --]

Hi, all

This is a patch for this bug. This bug adddress at  
bluetooth-device-select.c. While the dongle could be removed/inserted,  
the gnome-applet may crash due to access a 0x0 priv.

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


[-- Attachment #2: inquiry-crash.patch --]
[-- Type: text/x-patch, Size: 435 bytes --]

--- gnome/common/bluetooth-device-selection.c.orig	2008-03-10 14:18:37.000000000 +0800
+++ gnome/common/bluetooth-device-selection.c	2008-03-10 14:16:00.000000000 +0800
@@ -322,6 +322,9 @@
 	BluetoothDeviceSelectionPrivate *priv = BLUETOOTH_DEVICE_SELECTION_GET_PRIVATE(self);
 	char *adapter;
 
+	// skip if no priv
+	if (priv == NULL) return;
+
 	g_object_get (gobject, "default-adapter", &adapter, NULL);
 
 	if (adapter == NULL) {

[-- Attachment #3: Type: text/plain, Size: 228 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

[-- Attachment #4: Type: text/plain, Size: 164 bytes --]

_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Bluez-devel] [PATCH] bluez-gnome access volatile while adapter-changed
  2008-03-10  6:36 Ming-I Hsieh
@ 2008-03-10 23:29 ` Bastien Nocera
  0 siblings, 0 replies; 5+ messages in thread
From: Bastien Nocera @ 2008-03-10 23:29 UTC (permalink / raw)
  To: BlueZ development


On Mon, 2008-03-10 at 14:36 +0800, Ming-I Hsieh wrote:
> Hi, all
> 
> This is a patch for this bug. This bug adddress at  
> bluetooth-device-select.c. While the dongle could be removed/inserted,  
> the gnome-applet may crash due to access a 0x0 priv.

Good catch, but wrong fix, as we shouldn't even be listening to that
signal anymore. If you could please test the patch I uploaded at:
http://bugzilla.gnome.org/show_bug.cgi?id=519791#c4

I'll post it here for Marcel to apply if it fixes the problem for you.

Cheers


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Bluez-devel] [PATCH] bluez-gnome access volatile while adapter-changed
@ 2008-03-11  2:29 Ming-I Hsieh
  2008-03-11 18:35 ` Bastien Nocera
  0 siblings, 1 reply; 5+ messages in thread
From: Ming-I Hsieh @ 2008-03-11  2:29 UTC (permalink / raw)
  To: BlueZ development; +Cc: Bastien Nocera

Hi, hadess

Thanks, I had got the patch from bugzilla and it work fine to fix this  
problem.

Regards, Mihs

Quoting <>:

>
> On Mon, 2008-03-10 at 14:36 +0800, Ming-I Hsieh wrote:
>> Hi, all
>>
>> This is a patch for this bug. This bug adddress at
>> bluetooth-device-select.c. While the dongle could be removed/inserted,
>> the gnome-applet may crash due to access a 0x0 priv.
>
> Good catch, but wrong fix, as we shouldn't even be listening to that
> signal anymore. If you could please test the patch I uploaded at:
> http://bugzilla.gnome.org/show_bug.cgi?id=519791#c4
>
> I'll post it here for Marcel to apply if it fixes the problem for you.
>
> Cheers
>
>



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Bluez-devel] [PATCH] bluez-gnome access volatile while adapter-changed
  2008-03-11  2:29 [Bluez-devel] [PATCH] bluez-gnome access volatile while adapter-changed Ming-I Hsieh
@ 2008-03-11 18:35 ` Bastien Nocera
  2008-03-12 21:04   ` Marcel Holtmann
  0 siblings, 1 reply; 5+ messages in thread
From: Bastien Nocera @ 2008-03-11 18:35 UTC (permalink / raw)
  To: BlueZ development

[-- Attachment #1: Type: text/plain, Size: 307 bytes --]


On Tue, 2008-03-11 at 10:29 +0800, Ming-I Hsieh wrote:
> Hi, hadess
> 
> Thanks, I had got the patch from bugzilla and it work fine to fix this  
> problem.

This patch makes sure we're not receiving signals when the client object
is still alive, but the front-end device selection widget is gone.

Cheers

[-- Attachment #2: bluez-gnome-device-removal-crash-2.patch --]
[-- Type: text/x-patch, Size: 4347 bytes --]

Index: common/bluetooth-device-selection.c
===================================================================
RCS file: /cvsroot/bluez/gnome/common/bluetooth-device-selection.c,v
retrieving revision 1.19
diff -u -p -u -p -r1.19 bluetooth-device-selection.c
--- common/bluetooth-device-selection.c	7 Mar 2008 15:00:57 -0000	1.19
+++ common/bluetooth-device-selection.c	11 Mar 2008 15:44:23 -0000
@@ -54,6 +54,7 @@ struct _BluetoothDeviceSelectionPrivate 
 
 	gulong discov_started_id;
 	gulong discov_completed_id;
+	gulong default_adapter_changed_id;
 
 	/* Widgets/UI bits that can be shown or hidden */
 	GtkCellRenderer *bonded_cell;
@@ -596,8 +597,8 @@ bluetooth_device_selection_init(Bluetoot
 		gtk_widget_show (priv->device_type);
 	}
 
-	g_signal_connect (priv->client, "notify::default-adapter",
-			  G_CALLBACK (default_adapter_changed), self);
+	priv->default_adapter_changed_id = g_signal_connect (priv->client, "notify::default-adapter",
+							     G_CALLBACK (default_adapter_changed), self);
 }
 
 static void
@@ -607,6 +608,7 @@ bluetooth_device_selection_finalize (GOb
 
 	g_signal_handler_disconnect (G_OBJECT(priv->client), priv->discov_started_id);
 	g_signal_handler_disconnect (G_OBJECT(priv->client), priv->discov_completed_id);
+	g_signal_handler_disconnect (G_OBJECT(priv->client), priv->default_adapter_changed_id);
 
 	bluetooth_client_cancel_discovery (priv->client, NULL);
 }
Index: common/client.c
===================================================================
RCS file: /cvsroot/bluez/gnome/common/client.c,v
retrieving revision 1.43
diff -u -p -u -p -r1.43 client.c
--- common/client.c	7 Mar 2008 14:13:48 -0000	1.43
+++ common/client.c	11 Mar 2008 15:44:24 -0000
@@ -47,6 +47,7 @@ struct _BluetoothClientPrivate {
 	gboolean registered;
 
 	DBusGConnection *conn;
+	DBusGProxy *manager_object;
 	GtkTreeStore *store;
 	gchar *default_adapter;
 };
@@ -897,34 +898,33 @@ static void default_adapter_changed(DBus
 static void setup_manager(BluetoothClient *client)
 {
 	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
-	DBusGProxy *object;
 	GError *error = NULL;
 	char **array = NULL;
 
-	object = dbus_g_proxy_new_for_name(priv->conn, "org.bluez",
+	priv->manager_object = dbus_g_proxy_new_for_name(priv->conn, "org.bluez",
 					"/org/bluez", "org.bluez.Manager");
 
-	dbus_g_proxy_add_signal(object, "AdapterAdded",
+	dbus_g_proxy_add_signal(priv->manager_object, "AdapterAdded",
 					G_TYPE_STRING, G_TYPE_INVALID);
 
-	dbus_g_proxy_connect_signal(object, "AdapterAdded",
+	dbus_g_proxy_connect_signal(priv->manager_object, "AdapterAdded",
 				G_CALLBACK(adapter_added), client, NULL);
 
-	dbus_g_proxy_add_signal(object, "AdapterRemoved",
+	dbus_g_proxy_add_signal(priv->manager_object, "AdapterRemoved",
 					G_TYPE_STRING, G_TYPE_INVALID);
 
-	dbus_g_proxy_connect_signal(object, "AdapterRemoved",
+	dbus_g_proxy_connect_signal(priv->manager_object, "AdapterRemoved",
 				G_CALLBACK(adapter_removed), client, NULL);
 
-	dbus_g_proxy_add_signal(object, "DefaultAdapterChanged",
+	dbus_g_proxy_add_signal(priv->manager_object, "DefaultAdapterChanged",
 					G_TYPE_STRING, G_TYPE_INVALID);
 
-	dbus_g_proxy_connect_signal(object, "DefaultAdapterChanged",
+	dbus_g_proxy_connect_signal(priv->manager_object, "DefaultAdapterChanged",
 			G_CALLBACK(default_adapter_changed), client, NULL);
 
-	manager_default_adapter(object, &priv->default_adapter, NULL);
+	manager_default_adapter(priv->manager_object, &priv->default_adapter, NULL);
 
-	manager_list_adapters(object, &array, &error);
+	manager_list_adapters(priv->manager_object, &array, &error);
 
 	if (error == NULL) {
 		while (*array) {
@@ -974,9 +974,16 @@ static void bluetooth_client_finalize(GO
 {
 	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(object);
 
+	/* Disconnect the handlers from setup_manager() */
+	g_signal_handlers_disconnect_by_func (priv->manager_object, adapter_added, object);
+	g_signal_handlers_disconnect_by_func (priv->manager_object, adapter_removed, object);
+	g_signal_handlers_disconnect_by_func (priv->manager_object, default_adapter_changed,
+					      object);
+
 	priv->registered = FALSE;
 	g_free(priv->default_adapter);
 	g_object_unref(G_OBJECT(priv->store));
+	g_object_unref (priv->manager_object);
 }
 
 static void bluetooth_client_init(BluetoothClient *client)

[-- Attachment #3: Type: text/plain, Size: 228 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

[-- Attachment #4: Type: text/plain, Size: 164 bytes --]

_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Bluez-devel] [PATCH] bluez-gnome access volatile while adapter-changed
  2008-03-11 18:35 ` Bastien Nocera
@ 2008-03-12 21:04   ` Marcel Holtmann
  0 siblings, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2008-03-12 21:04 UTC (permalink / raw)
  To: BlueZ development

Hi Bastien,

> > Thanks, I had got the patch from bugzilla and it work fine to fix this  
> > problem.
> 
> This patch makes sure we're not receiving signals when the client object
> is still alive, but the front-end device selection widget is gone.

patch has been applied. Thanks.

Regards

Marcel



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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-03-12 21:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-11  2:29 [Bluez-devel] [PATCH] bluez-gnome access volatile while adapter-changed Ming-I Hsieh
2008-03-11 18:35 ` Bastien Nocera
2008-03-12 21:04   ` Marcel Holtmann
  -- strict thread matches above, loose matches on Subject: below --
2008-03-10  6:36 Ming-I Hsieh
2008-03-10 23:29 ` Bastien Nocera

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox