[gnome-bluetooth] lib: fix g_object_unref: assertion `G_IS_OBJECT (object)' failed



commit 04fe1c61941327aa719b9d0d5f0329a349c1e11d
Author: Daniele Forsi <dforsi src gnome org>
Date:   Mon May 7 11:56:47 2012 +0200

    lib: fix g_object_unref: assertion `G_IS_OBJECT (object)' failed
    
    Using bluetooth-sendto the client object is finalized before the
    callback could set priv->model; this can happen because priv->model
    is set and unset asynchronously by bluez_appeared_cb() and by
    bluez_vanished_cb().
    
    Fixes:
    (lt-bluetooth-sendto:13209): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed
    
    Program received signal SIGTRAP, Trace/breakpoint trap.
    0xb75aa22d in g_logv () from /lib/i386-linux-gnu/libglib-2.0.so.0
    (gdb) bt
     #0  0xb75aa22d in g_logv () from /lib/i386-linux-gnu/libglib-2.0.so.0
     #1  0xb75aa3c3 in g_log () from /lib/i386-linux-gnu/libglib-2.0.so.0
     #2  0xb75aa40d in g_return_if_fail_warning () from /lib/i386-linux-gnu/libglib-2.0.so.0
     #3  0xb766892b in g_object_unref () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
     #4  0xb7fc4f7b in bluetooth_client_finalize (client=0x824a120) at bluetooth-client.c:1272
     #5  0xb7668ae8 in g_object_unref () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
     #6  0x0804bc69 in get_device_name (address=0x80586a0 "1") at main.c:377
     #7  main (argc=1, argv=0xbffff4b4) at main.c:830

 lib/bluetooth-client.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index af3a6f5..5ed7c7c 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -1269,7 +1269,8 @@ static void bluetooth_client_finalize(GObject *client)
 
 	g_type_class_unref (g_type_class_peek (BLUETOOTH_TYPE_STATUS));
 
-	g_object_unref(priv->manager);
+	if (priv->manager)
+		g_object_unref (priv->manager);
 
 	g_object_unref(priv->store);
 



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