a11y: Plug a memory leak with treeviews

We need to explicitly remove the children from
a GtkContainerCellAccessible, since they otherwise
keep the parent alive.

Fixes: #3981
This commit is contained in:
Matthias Clasen 2021-06-11 08:55:48 -04:00
parent d4f62b44d4
commit 21f8098261

View File

@ -104,6 +104,17 @@ static void
cell_info_free (GtkTreeViewAccessibleCellInfo *cell_info)
{
gtk_accessible_set_widget (GTK_ACCESSIBLE (cell_info->cell), NULL);
if (GTK_IS_CONTAINER_CELL_ACCESSIBLE (cell_info->cell))
{
GList *children;
while ((children = gtk_container_cell_accessible_get_children (GTK_CONTAINER_CELL_ACCESSIBLE (cell_info->cell))) != NULL)
{
GtkCellAccessible *child = children->data;
gtk_container_cell_accessible_remove_child (GTK_CONTAINER_CELL_ACCESSIBLE (cell_info->cell), child);
}
}
g_object_unref (cell_info->cell);
g_free (cell_info);