[gtk/fix-a11y-leak] a11y: Fix a memory leak
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/fix-a11y-leak] a11y: Fix a memory leak
- Date: Fri, 12 Aug 2022 16:03:31 +0000 (UTC)
commit e81db46578590d8130f4d1f63a239baf0f32a9e2
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Aug 12 12:01:42 2022 -0400
a11y: Fix a memory leak
We need to free the queued context list in dispose
if we didn't get to register the contexts, and we also
need to free the list properly when we do get to
register them.
This showed up in valgrind as leaked GList structs.
gtk/a11y/gtkatspiroot.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/gtk/a11y/gtkatspiroot.c b/gtk/a11y/gtkatspiroot.c
index bffc632c18..1335c7fb24 100644
--- a/gtk/a11y/gtkatspiroot.c
+++ b/gtk/a11y/gtkatspiroot.c
@@ -106,6 +106,7 @@ gtk_at_spi_root_dispose (GObject *gobject)
g_clear_object (&self->cache);
g_clear_object (&self->connection);
+ g_clear_pointer (&self->queued_contexts, g_list_free);
G_OBJECT_CLASS (gtk_at_spi_root_parent_class)->dispose (gobject);
}
@@ -517,7 +518,8 @@ on_registration_reply (GObject *gobject,
/* Drain the list of queued GtkAtSpiContexts, and add them to the cache */
if (self->queued_contexts != NULL)
{
- for (GList *l = g_list_reverse (self->queued_contexts); l != NULL; l = l->next)
+ self->queued_contexts = g_list_reverse (self->queued_contexts);
+ for (GList *l = self->queued_contexts; l != NULL; l = l->next)
{
if (data->register_func != NULL)
data->register_func (self, l->data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]