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.
This commit is contained in:
Timm Bäder 2019-05-03 08:10:50 +02:00 committed by Timm Bäder
parent c675d1c9e1
commit 596c9a3c0b

View File

@ -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);