summaryrefslogtreecommitdiff
path: root/gtk/gtkgizmo.c
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2017-05-11 21:52:18 +0200
committerMatthias Clasen <mclasen@redhat.com>2017-07-19 21:27:12 -0400
commit11207505e3dbc87a8dfc419ffb10a42489e93464 (patch)
treebc84a298f243db75e782ba39df139c033edb77ab /gtk/gtkgizmo.c
parent017dfc132d10eaff5b32ae2839ff1dc8eed99dcf (diff)
downloadgtk+-11207505e3dbc87a8dfc419ffb10a42489e93464.tar.gz
gizmo: Unparent all child widgets in finalize
Diffstat (limited to 'gtk/gtkgizmo.c')
-rw-r--r--gtk/gtkgizmo.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gtk/gtkgizmo.c b/gtk/gtkgizmo.c
index 38cd3d56b1..f80fabe3ee 100644
--- a/gtk/gtkgizmo.c
+++ b/gtk/gtkgizmo.c
@@ -51,10 +51,32 @@ gtk_gizmo_snapshot (GtkWidget *widget,
}
static void
+gtk_gizmo_finalize (GObject *object)
+{
+ GtkGizmo *self = GTK_GIZMO (object);
+ GtkWidget *widget;
+
+ widget = _gtk_widget_get_first_child (GTK_WIDGET (self));
+ while (widget != NULL)
+ {
+ GtkWidget *next = _gtk_widget_get_next_sibling (widget);
+
+ gtk_widget_unparent (widget);
+
+ widget = next;
+ }
+
+ G_OBJECT_CLASS (gtk_gizmo_parent_class)->finalize (object);
+}
+
+static void
gtk_gizmo_class_init (GtkGizmoClass *klass)
{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+ object_class->finalize = gtk_gizmo_finalize;
+
widget_class->measure = gtk_gizmo_measure;
widget_class->size_allocate = gtk_gizmo_size_allocate;
widget_class->snapshot = gtk_gizmo_snapshot;