|
|
dca6ef |
From d4f62b44d47e3dddfb57add4f1f76cab0297584d Mon Sep 17 00:00:00 2001
|
|
|
dca6ef |
From: Matthias Clasen <mclasen@redhat.com>
|
|
|
dca6ef |
Date: Fri, 11 Jun 2021 08:53:46 -0400
|
|
|
dca6ef |
Subject: [PATCH 1/2] a11y: Fix ref counting in tree views
|
|
|
dca6ef |
|
|
|
dca6ef |
GtkContainerCellAccessible wasn't unsetting accessible
|
|
|
dca6ef |
parents. Fix that.
|
|
|
dca6ef |
|
|
|
dca6ef |
By itself, this doesn't help for freeing a memory leak,
|
|
|
dca6ef |
since AtkObject keeps a ref on its parent, so we never
|
|
|
dca6ef |
free the GtkContainerCellAccessible as long as it has children.
|
|
|
dca6ef |
---
|
|
|
dca6ef |
gtk/a11y/gtkcontainercellaccessible.c | 10 +++++++++-
|
|
|
dca6ef |
1 file changed, 9 insertions(+), 1 deletion(-)
|
|
|
dca6ef |
|
|
|
dca6ef |
diff --git a/gtk/a11y/gtkcontainercellaccessible.c b/gtk/a11y/gtkcontainercellaccessible.c
|
|
|
dca6ef |
index a756e3cadf..a40446fb47 100644
|
|
|
dca6ef |
--- a/gtk/a11y/gtkcontainercellaccessible.c
|
|
|
dca6ef |
+++ b/gtk/a11y/gtkcontainercellaccessible.c
|
|
|
dca6ef |
@@ -30,12 +30,19 @@ struct _GtkContainerCellAccessiblePrivate
|
|
|
dca6ef |
G_DEFINE_TYPE_WITH_PRIVATE (GtkContainerCellAccessible, gtk_container_cell_accessible, GTK_TYPE_CELL_ACCESSIBLE)
|
|
|
dca6ef |
|
|
|
dca6ef |
|
|
|
dca6ef |
+static void
|
|
|
dca6ef |
+unset_child (gpointer child)
|
|
|
dca6ef |
+{
|
|
|
dca6ef |
+ atk_object_set_parent (ATK_OBJECT (child), NULL);
|
|
|
dca6ef |
+ g_object_unref (child);
|
|
|
dca6ef |
+}
|
|
|
dca6ef |
+
|
|
|
dca6ef |
static void
|
|
|
dca6ef |
gtk_container_cell_accessible_finalize (GObject *obj)
|
|
|
dca6ef |
{
|
|
|
dca6ef |
GtkContainerCellAccessible *container = GTK_CONTAINER_CELL_ACCESSIBLE (obj);
|
|
|
dca6ef |
|
|
|
dca6ef |
- g_list_free_full (container->priv->children, g_object_unref);
|
|
|
dca6ef |
+ g_list_free_full (container->priv->children, unset_child);
|
|
|
dca6ef |
|
|
|
dca6ef |
G_OBJECT_CLASS (gtk_container_cell_accessible_parent_class)->finalize (obj);
|
|
|
dca6ef |
}
|
|
|
dca6ef |
@@ -157,6 +164,7 @@ gtk_container_cell_accessible_remove_child (GtkContainerCellAccessible *containe
|
|
|
dca6ef |
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (child));
|
|
|
dca6ef |
g_return_if_fail (container->priv->n_children > 0);
|
|
|
dca6ef |
|
|
|
dca6ef |
+ atk_object_set_parent (ATK_OBJECT (child), NULL);
|
|
|
dca6ef |
container->priv->children = g_list_remove (container->priv->children, child);
|
|
|
dca6ef |
container->priv->n_children--;
|
|
|
dca6ef |
|
|
|
dca6ef |
--
|
|
|
dca6ef |
GitLab
|
|
|
dca6ef |
|
|
|
dca6ef |
|
|
|
dca6ef |
From 21f8098261486417db371b202bc0494c12017468 Mon Sep 17 00:00:00 2001
|
|
|
dca6ef |
From: Matthias Clasen <mclasen@redhat.com>
|
|
|
dca6ef |
Date: Fri, 11 Jun 2021 08:55:48 -0400
|
|
|
dca6ef |
Subject: [PATCH 2/2] a11y: Plug a memory leak with treeviews
|
|
|
dca6ef |
|
|
|
dca6ef |
We need to explicitly remove the children from
|
|
|
dca6ef |
a GtkContainerCellAccessible, since they otherwise
|
|
|
dca6ef |
keep the parent alive.
|
|
|
dca6ef |
|
|
|
dca6ef |
Fixes: #3981
|
|
|
dca6ef |
---
|
|
|
dca6ef |
gtk/a11y/gtktreeviewaccessible.c | 11 +++++++++++
|
|
|
dca6ef |
1 file changed, 11 insertions(+)
|
|
|
dca6ef |
|
|
|
dca6ef |
diff --git a/gtk/a11y/gtktreeviewaccessible.c b/gtk/a11y/gtktreeviewaccessible.c
|
|
|
dca6ef |
index adad462064..c1a2097a1e 100644
|
|
|
dca6ef |
--- a/gtk/a11y/gtktreeviewaccessible.c
|
|
|
dca6ef |
+++ b/gtk/a11y/gtktreeviewaccessible.c
|
|
|
dca6ef |
@@ -104,6 +104,17 @@ static void
|
|
|
dca6ef |
cell_info_free (GtkTreeViewAccessibleCellInfo *cell_info)
|
|
|
dca6ef |
{
|
|
|
dca6ef |
gtk_accessible_set_widget (GTK_ACCESSIBLE (cell_info->cell), NULL);
|
|
|
dca6ef |
+ if (GTK_IS_CONTAINER_CELL_ACCESSIBLE (cell_info->cell))
|
|
|
dca6ef |
+ {
|
|
|
dca6ef |
+ GList *children;
|
|
|
dca6ef |
+
|
|
|
dca6ef |
+ while ((children = gtk_container_cell_accessible_get_children (GTK_CONTAINER_CELL_ACCESSIBLE (cell_info->cell))) != NULL)
|
|
|
dca6ef |
+ {
|
|
|
dca6ef |
+ GtkCellAccessible *child = children->data;
|
|
|
dca6ef |
+ gtk_container_cell_accessible_remove_child (GTK_CONTAINER_CELL_ACCESSIBLE (cell_info->cell), child);
|
|
|
dca6ef |
+ }
|
|
|
dca6ef |
+ }
|
|
|
dca6ef |
+
|
|
|
dca6ef |
g_object_unref (cell_info->cell);
|
|
|
dca6ef |
|
|
|
dca6ef |
g_free (cell_info);
|
|
|
dca6ef |
--
|
|
|
dca6ef |
GitLab
|
|
|
dca6ef |
|