[empathy] ui-utils: don't expect that cancellable is not NULL



commit bc690f37e7b0a49258b505653dd0cb94ffa48056
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Wed Nov 30 12:55:29 2011 +0100

    ui-utils: don't expect that cancellable is not NULL
    
    cancellable are always optional so this code should be NULL safe.

 libempathy-gtk/empathy-ui-utils.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c
index a387160..f354980 100644
--- a/libempathy-gtk/empathy-ui-utils.c
+++ b/libempathy-gtk/empathy-ui-utils.c
@@ -552,7 +552,8 @@ pixbuf_avatar_from_individual_closure_new (FolksIndividual    *individual,
 	closure->result = g_object_ref (result);
 	closure->width = width;
 	closure->height = height;
-	closure->cancellable = g_object_ref (cancellable);
+	if (cancellable != NULL)
+		closure->cancellable = g_object_ref (cancellable);
 
 	return closure;
 }
@@ -561,7 +562,7 @@ static void
 pixbuf_avatar_from_individual_closure_free (
 		PixbufAvatarFromIndividualClosure *closure)
 {
-	g_object_unref (closure->cancellable);
+	g_clear_object (&closure->cancellable);
 	tp_clear_object (&closure->loader);
 	g_object_unref (closure->individual);
 	g_object_unref (closure->result);



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