[gnome-bluetooth] applet: Make sure agent is set to NULL when released
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth] applet: Make sure agent is set to NULL when released
- Date: Wed, 27 Oct 2010 20:03:49 +0000 (UTC)
commit ec55c7e64265ec9c3a05a26ff50d6a62fce5a853
Author: Bastien Nocera <hadess hadess net>
Date: Wed Oct 27 20:50:04 2010 +0100
applet: Make sure agent is set to NULL when released
When the agent is released by bluetoothd, we unref' it, so we
might end up with an agent pointing to nothing. Using a weak
pointer makes sure we don't crash.
applet/lib/bluetooth-applet.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/applet/lib/bluetooth-applet.c b/applet/lib/bluetooth-applet.c
index 07a63c7..78f69f6 100644
--- a/applet/lib/bluetooth-applet.c
+++ b/applet/lib/bluetooth-applet.c
@@ -427,6 +427,9 @@ find_default_adapter (BluetoothApplet* self)
gtk_tree_model_get (self->client_model, self->default_adapter,
BLUETOOTH_COLUMN_PROXY, &adapter, -1);
+ /* This makes sure that the agent is NULL when released */
+ g_object_add_weak_pointer (G_OBJECT (self->agent), (gpointer *) (&self->agent));
+
self->agent = bluetooth_agent_new();
bluetooth_agent_set_pincode_func (self->agent, pincode_request, self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]