[gtk+] places sidebar: Make a function NULL-safe



commit f211031a9fb47b32feb3dc211f75d3a3c238689a
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jan 28 18:25:32 2015 -0500

    places sidebar: Make a function NULL-safe
    
    gtk_places_sidebar_set_location's location argument is documented
    as allow-none, but if one actually passes NULL, a warning results.
    Fix that.

 gtk/gtkplacessidebar.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index d6d3dd6..fecb94f 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -4790,7 +4790,9 @@ gtk_places_sidebar_set_location (GtkPlacesSidebar *sidebar,
 
   if (sidebar->current_location != NULL)
     g_object_unref (sidebar->current_location);
-  sidebar->current_location = g_object_ref (location);
+  sidebar->current_location = location;
+  if (sidebar->current_location != NULL)
+    g_object_ref (sidebar->current_location);
 
   if (location == NULL)
           goto out;


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