From: Bastien Nocera <hadess@hadess.net>
To: BlueZ development <bluez-devel@lists.sourceforge.net>
Subject: Re: [Bluez-devel] [PATCH] bluez-gnome access volatile while adapter-changed
Date: Tue, 11 Mar 2008 18:35:26 +0000 [thread overview]
Message-ID: <1205260526.30595.91.camel@cookie.hadess.net> (raw)
In-Reply-To: <20080311102907.kkvnan148sgo8o8k@wmlab.csie.ncu.edu.tw>
[-- 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
next prev parent reply other threads:[~2008-03-11 18:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1205260526.30595.91.camel@cookie.hadess.net \
--to=hadess@hadess.net \
--cc=bluez-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox