diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2019-06-17 09:26:39 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2019-06-30 23:42:44 +0100 |
commit | bd2349c0a0993c8f05a4eabf51e8793398f2b6eb (patch) | |
tree | 9df0551b6ce5c8125569e4edde7919a22e6b6f42 /gtk/gtklayoutmanager.c | |
parent | 636fbc0f1aac8d03dd75b5c0491b7c462ab826df (diff) | |
download | gtk+-bd2349c0a0993c8f05a4eabf51e8793398f2b6eb.tar.gz |
Do not leak LayoutChild instances
Since the LayoutManager owns the LayoutChild it creates, it's also
responsible for mopping them up.
Diffstat (limited to 'gtk/gtklayoutmanager.c')
-rw-r--r-- | gtk/gtklayoutmanager.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gtk/gtklayoutmanager.c b/gtk/gtklayoutmanager.c index 1aa7724d49..547c76bbdf 100644 --- a/gtk/gtklayoutmanager.c +++ b/gtk/gtklayoutmanager.c @@ -200,8 +200,23 @@ gtk_layout_manager_real_create_layout_child (GtkLayoutManager *manager, } static void +gtk_layout_manager_finalize (GObject *gobject) +{ + GtkLayoutManager *self = GTK_LAYOUT_MANAGER (gobject); + GtkLayoutManagerPrivate *priv = gtk_layout_manager_get_instance_private (self); + + g_clear_pointer (&priv->layout_children, g_hash_table_unref); + + G_OBJECT_CLASS (gtk_layout_manager_parent_class)->finalize (gobject); +} + +static void gtk_layout_manager_class_init (GtkLayoutManagerClass *klass) { + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + + gobject_class->finalize = gtk_layout_manager_finalize; + klass->get_request_mode = gtk_layout_manager_real_get_request_mode; klass->measure = gtk_layout_manager_real_measure; klass->allocate = gtk_layout_manager_real_allocate; |