[gtk/kill-containers: 138/199] textviewchild: Don't leak children
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/kill-containers: 138/199] textviewchild: Don't leak children
- Date: Tue, 12 May 2020 00:35:29 +0000 (UTC)
commit e516616cca2cd790faf0d4d0b451cebbceb8da38
Author: Matthias Clasen <mclasen redhat com>
Date: Mon May 11 20:31:14 2020 -0400
textviewchild: Don't leak children
Like everybody else, GtkTextViewChild must
unparent its children in dispose.
gtk/gtktextviewchild.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
---
diff --git a/gtk/gtktextviewchild.c b/gtk/gtktextviewchild.c
index 1462f3ecbd..a8a42278d1 100644
--- a/gtk/gtktextviewchild.c
+++ b/gtk/gtktextviewchild.c
@@ -373,6 +373,18 @@ gtk_text_view_child_set_property (GObject *object,
}
}
+static void
+gtk_text_view_child_dispose (GObject *object)
+{
+ GtkTextViewChild *self = GTK_TEXT_VIEW_CHILD (object);
+ GtkWidget *child;
+
+ while ((child = gtk_widget_get_first_child (GTK_WIDGET (self))))
+ gtk_text_view_child_remove (self, child);
+
+ G_OBJECT_CLASS (gtk_text_view_child_parent_class)->dispose (object);
+}
+
static void
gtk_text_view_child_class_init (GtkTextViewChildClass *klass)
{
@@ -380,6 +392,7 @@ gtk_text_view_child_class_init (GtkTextViewChildClass *klass)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
+ object_class->dispose = gtk_text_view_child_dispose;
object_class->constructed = gtk_text_view_child_constructed;
object_class->get_property = gtk_text_view_child_get_property;
object_class->set_property = gtk_text_view_child_set_property;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]