[gtk+] [filechooser] Free things which got duplicated or reffed by gtk_tree_model_get()



commit eb02dacb370e8b4e6ef62328d0c09673b1234b32
Author: Federico Mena Quintero <federico gnome org>
Date:   Fri Apr 1 16:16:17 2011 -0600

    [filechooser] Free things which got duplicated or reffed by gtk_tree_model_get()
    
    We had forgotten to do that in a few places; this is a systematic search for those.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=646461

 gtk/gtkfilechooserbutton.c  |    5 ++++-
 gtk/gtkfilechooserdefault.c |    4 +++-
 gtk/gtkfilechooserentry.c   |    5 +++--
 3 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c
index 8b917fb..c12ef91 100644
--- a/gtk/gtkfilechooserbutton.c
+++ b/gtk/gtkfilechooserbutton.c
@@ -1551,7 +1551,10 @@ model_free_row_data (GtkFileChooserButton *button,
 		      -1);
 
   if (cancellable)
-    g_cancellable_cancel (cancellable);
+    {
+      g_cancellable_cancel (cancellable);
+      g_object_unref (cancellable);
+    }
 
   switch (type)
     {
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index 2022a3d..b5e46d5 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -3195,7 +3195,7 @@ shortcuts_reorder (GtkFileChooserDefault *impl,
   int bookmarks_index;
   GFile *file;
   GError *error;
-  gchar *name;
+  gchar *name = NULL;
 
   /* Get the selected path */
 
@@ -3241,6 +3241,7 @@ shortcuts_reorder (GtkFileChooserDefault *impl,
  out:
 
   g_object_unref (file);
+  g_free (name);
 }
 
 /* Callback used when we get the drag data for the bookmarks list.  We add the
@@ -10035,6 +10036,7 @@ list_row_activated (GtkTreeView           *tree_view,
   if (is_folder && file)
     {
       change_folder_and_display_error (impl, file, FALSE);
+      g_object_unref (file);
       goto out;
     }
 
diff --git a/gtk/gtkfilechooserentry.c b/gtk/gtkfilechooserentry.c
index 4ac71ed..d0d043f 100644
--- a/gtk/gtkfilechooserentry.c
+++ b/gtk/gtkfilechooserentry.c
@@ -336,8 +336,9 @@ match_selected_callback (GtkEntryCompletion  *completion,
 
   if (!display_name || !file)
     {
-      /* these shouldn't complain if passed NULL */
-      g_object_unref (file);
+      if (file)
+	g_object_unref (file);
+
       g_free (display_name);
       return FALSE;
     }



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