[gtk+/gtk-3-22] file button: Don't leak rows



commit 081488f8f2ac608dabde22493f18d99b49d4e70a
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jan 5 11:09:04 2018 -0500

    file button: Don't leak rows
    
    The file chooser button manually manages the memory of
    data in its model, so it needs to explicitly free the
    rows.

 gtk/gtkfilechooserbutton.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c
index e5c0225..42a8abb 100644
--- a/gtk/gtkfilechooserbutton.c
+++ b/gtk/gtkfilechooserbutton.c
@@ -994,8 +994,11 @@ gtk_file_chooser_button_finalize (GObject *object)
   if (priv->current_folder_while_inactive)
     g_object_unref (priv->current_folder_while_inactive);
 
-  if (priv->model != NULL)
-    g_object_unref (priv->model);
+  if (priv->model)
+    {
+      model_remove_rows (button, 0, gtk_tree_model_iter_n_children (priv->model, NULL));
+      g_object_unref (priv->model);
+    }
 
   G_OBJECT_CLASS (gtk_file_chooser_button_parent_class)->finalize (object);
 }


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