Commit 2dfad2b0 authored by Matthias Clasen's avatar Matthias Clasen

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.
parent 50a24287
......@@ -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);
}
......
......@@ -467,7 +467,6 @@
</child>
</object>
<object class="GtkPopover" id="rename_file_popover">
<property name="relative-to">browse_files_tree_view</property>
<property name="position">bottom</property>
<signal name="closed" handler="rename_file_end"/>
<child>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment