From 577783a19db6f45deb732be6e24724c7cfeb28c0 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 1 Mar 2016 15:57:36 -0500 Subject: [PATCH] scale: Don't leave css nodes behind We create and destroy gadgets inside the scale hierarchy here, and if we don't explicitly remove their CSS nodes from the parent, they stick around. --- gtk/gtkscale.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c index ab49746342..33e5199566 100644 --- a/gtk/gtkscale.c +++ b/gtk/gtkscale.c @@ -1869,8 +1869,12 @@ gtk_scale_mark_free (gpointer data) { GtkScaleMark *mark = data; + if (mark->label_gadget) + gtk_css_node_set_parent (gtk_css_gadget_get_node (mark->label_gadget), NULL); g_clear_object (&mark->label_gadget); + gtk_css_node_set_parent (gtk_css_gadget_get_node (mark->indicator_gadget), NULL); g_object_unref (mark->indicator_gadget); + gtk_css_node_set_parent (gtk_css_gadget_get_node (mark->gadget), NULL); g_object_unref (mark->gadget); g_free (mark->markup); g_free (mark); @@ -1896,7 +1900,11 @@ gtk_scale_clear_marks (GtkScale *scale) g_slist_free_full (priv->marks, gtk_scale_mark_free); priv->marks = NULL; + if (priv->top_marks_gadget) + gtk_css_node_set_parent (gtk_css_gadget_get_node (priv->top_marks_gadget), NULL); g_clear_object (&priv->top_marks_gadget); + if (priv->bottom_marks_gadget) + gtk_css_node_set_parent (gtk_css_gadget_get_node (priv->bottom_marks_gadget), NULL); g_clear_object (&priv->bottom_marks_gadget); _gtk_range_set_stop_values (GTK_RANGE (scale), NULL, 0);