filechooserwidget: Stop leaking file system models
authorCorey Berla <corey@berla.me>
Mon, 15 May 2023 20:09:52 +0000 (13:09 -0700)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 5 Jun 2023 11:50:25 +0000 (07:50 -0400)
gtk/gtkfilechooserwidget.c

index ace31f4bd890e2ab4498cdcb097ca22df1733693..46ff782557114cb3975fa04bc519770e950be2bc 100644 (file)
@@ -578,7 +578,10 @@ gtk_file_chooser_widget_finalize (GObject *object)
   stop_loading_and_clear_list_model (impl, FALSE);
   search_clear_model (impl, FALSE);
   recent_clear_model (impl, FALSE);
+  g_clear_object (&impl->recent_model);
+  g_clear_object (&impl->search_model);
   g_clear_object (&impl->model_for_search);
+  g_clear_object (&impl->browse_files_model);
 
   g_clear_object (&impl->selection_model);
   g_clear_object (&impl->sort_model);
@@ -3981,6 +3984,7 @@ set_list_model (GtkFileChooserWidget  *impl,
 
   set_busy_cursor (impl, TRUE);
 
+  g_clear_object (&impl->browse_files_model);
   impl->browse_files_model =
     _gtk_file_system_model_new_for_directory (impl->current_folder, MODEL_ATTRIBUTES);