[gnome-bluetooth] wizard: Set agent to NULL if released before we do it



commit 070442f0c3ae8655fd6ea0ebb623d0686c621741
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Oct 27 20:35:30 2010 +0100

    wizard: Set agent to NULL if released before we do it

 wizard/main.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/wizard/main.c b/wizard/main.c
index bb1f969..350fa2f 100644
--- a/wizard/main.c
+++ b/wizard/main.c
@@ -1029,6 +1029,7 @@ int main (int argc, char **argv)
 	client = bluetooth_client_new();
 
 	agent = bluetooth_agent_new();
+	g_object_add_weak_pointer (G_OBJECT (agent), (gpointer *) (&agent));
 
 	bluetooth_agent_set_pincode_func(agent, pincode_callback, NULL);
 	bluetooth_agent_set_display_func(agent, display_callback, NULL);
@@ -1052,7 +1053,8 @@ int main (int argc, char **argv)
 
 	bluetooth_plugin_manager_cleanup ();
 
-	g_object_unref(agent);
+	if (agent != NULL)
+		g_object_unref (agent);
 
 	g_object_unref(client);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]