[gtk] filechooserbutton: Clear model in destroy()



commit 596c9a3c0b9511a1e3ffdc14ffc0b2a66cdb0e70
Author: Timm Bäder <tbaeder redhat com>
Date:   Fri May 3 08:10:50 2019 +0200

    filechooserbutton: Clear model in destroy()
    
    Since we're destroying priv->chooser right after. We can't wait until
    finalize() since clearing the model will try to work with priv->chooser.

 gtk/gtkfilechooserbutton.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c
index ea9de54450..ef4e000d90 100644
--- a/gtk/gtkfilechooserbutton.c
+++ b/gtk/gtkfilechooserbutton.c
@@ -994,12 +994,6 @@ gtk_file_chooser_button_finalize (GObject *object)
   if (priv->current_folder_while_inactive)
     g_object_unref (priv->current_folder_while_inactive);
 
-  if (priv->model)
-    {
-      model_remove_rows (button, 0, gtk_tree_model_iter_n_children (priv->model, NULL));
-      g_object_unref (priv->model);
-    }
-
   gtk_widget_unparent (priv->button);
   gtk_widget_unparent (priv->combo_box);
 
@@ -1032,6 +1026,12 @@ gtk_file_chooser_button_destroy (GtkWidget *widget)
   GtkFileChooserButtonPrivate *priv = gtk_file_chooser_button_get_instance_private (button);
   GSList *l;
 
+  if (priv->model)
+    {
+      model_remove_rows (button, 0, gtk_tree_model_iter_n_children (priv->model, NULL));
+      g_clear_object (&priv->model);
+    }
+
   if (priv->dialog != NULL)
     {
       gtk_widget_destroy (priv->dialog);


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