[nautilus/wip/antoniof/properties-fixes: 1/3] properties-window: Stop leaking extension models
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/properties-fixes: 1/3] properties-window: Stop leaking extension models
- Date: Wed, 7 Sep 2022 12:47:13 +0000 (UTC)
commit 8db7cb066f66df6fd15b6f0cfd924da11f1f5038
Author: António Fernandes <antoniof gnome org>
Date: Wed Sep 7 11:02:57 2022 +0100
properties-window: Stop leaking extension models
We create a GListStore whose first reference we never release, so
it leaks and, with it, all objects which it owns a reference to.
We keep a GList for cleanup which gives the false illusion that we
are doing a good job at memory management, which is a lie.
Deeply free the list after use instead, and release the first
reference to the list store too. The list box keeps the list store
alive as its internal module and releases it when destroyed.
src/nautilus-properties-window.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
---
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 1d823edd7..c415f2f15 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -133,7 +133,6 @@ struct _NautilusPropertiesWindow
GtkWidget *permissions_value_label;
GtkWidget *extension_models_list_box;
- GList *extensions_properties_models;
/* Permissions page */
@@ -3666,8 +3665,8 @@ setup_permissions_page (NautilusPropertiesWindow *self)
static void
refresh_extension_model_pages (NautilusPropertiesWindow *self)
{
- GListStore *extensions_list = g_list_store_new (NAUTILUS_TYPE_PROPERTIES_MODEL);
- GList *all_models = NULL;
+ g_autoptr (GListStore) extensions_list = g_list_store_new (NAUTILUS_TYPE_PROPERTIES_MODEL);
+ g_autolist (NautilusPropertiesModel) all_models = NULL;
g_autolist (GObject) providers =
nautilus_module_get_extensions_for_type (NAUTILUS_TYPE_PROPERTIES_MODEL_PROVIDER);
@@ -3678,10 +3677,6 @@ refresh_extension_model_pages (NautilusPropertiesWindow *self)
all_models = g_list_concat (all_models, models);
}
- g_clear_list (&self->extensions_properties_models, g_object_unref);
- self->extensions_properties_models = all_models;
-
-
for (GList *l = all_models; l != NULL; l = l->next)
{
g_list_store_append (extensions_list, NAUTILUS_PROPERTIES_MODEL (l->data));
@@ -4147,8 +4142,6 @@ real_dispose (GObject *object)
g_clear_list (&self->changed_files, (GDestroyNotify) nautilus_file_unref);
- g_clear_list (&self->extensions_properties_models, g_object_unref);
-
g_clear_handle_id (&self->deep_count_spinner_timeout_id, g_source_remove);
while (self->deep_count_files)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]