diff options
author | Matthias Clasen <mclasen@redhat.com> | 2015-07-20 11:11:00 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2015-07-20 11:12:49 -0400 |
commit | 2dfad2b0d1cad454c4b68625be1e169023aaaed4 (patch) | |
tree | d545bb8e7669e0c80ac5f22959871fd4a0645512 /gtk/gtkfilechooserwidget.c | |
parent | 50a2428739451bad218940d10c63b604da3b9c21 (diff) | |
download | gtk+-2dfad2b0d1cad454c4b68625be1e169023aaaed4.tar.gz |
file chooser: Memory handling fixes
I forgot to clean up the long press gesture, and in additon, creating
the rename popover from the ui template was causing the tree view
to not be disposed when the file chooser goes away. Work around this
by manually unsetting the relative-to widget of the popover in dispose.
Diffstat (limited to 'gtk/gtkfilechooserwidget.c')
-rw-r--r-- | gtk/gtkfilechooserwidget.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index 2ddd1605b9..cafb5ab418 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -649,7 +649,6 @@ gtk_file_chooser_widget_finalize (GObject *object) { GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (object); GtkFileChooserWidgetPrivate *priv = impl->priv; - GSList *l; if (priv->location_changed_id > 0) g_source_remove (priv->location_changed_id); @@ -658,14 +657,7 @@ gtk_file_chooser_widget_finalize (GObject *object) g_free (priv->browse_files_last_selected_name); - for (l = priv->filters; l; l = l->next) - { - GtkFileFilter *filter; - - filter = GTK_FILE_FILTER (l->data); - g_object_unref (filter); - } - g_slist_free (priv->filters); + g_slist_free_full (priv->filters, g_object_unref); if (priv->current_filter) g_object_unref (priv->current_filter); @@ -3526,6 +3518,9 @@ gtk_file_chooser_widget_dispose (GObject *object) cancel_all_operations (impl); + if (priv->rename_file_popover) + gtk_popover_set_relative_to (GTK_POPOVER (priv->rename_file_popover), NULL); + if (priv->browse_files_popover) { gtk_widget_destroy (priv->browse_files_popover); @@ -3552,6 +3547,8 @@ gtk_file_chooser_widget_dispose (GObject *object) priv->external_entry = NULL; } + g_clear_object (&priv->long_press_gesture); + G_OBJECT_CLASS (gtk_file_chooser_widget_parent_class)->dispose (object); } @@ -8452,6 +8449,7 @@ post_process_ui (GtkFileChooserWidget *impl) gtk_popover_set_default_widget (GTK_POPOVER (impl->priv->new_folder_popover), impl->priv->new_folder_create_button); gtk_popover_set_default_widget (GTK_POPOVER (impl->priv->rename_file_popover), impl->priv->rename_file_rename_button); + gtk_popover_set_relative_to (GTK_POPOVER (impl->priv->rename_file_popover), impl->priv->browse_files_tree_view); add_actions (impl); } |