summaryrefslogtreecommitdiff
path: root/gtk/gtkscalebutton.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2016-11-28 15:00:10 -0500
committerMatthias Clasen <mclasen@redhat.com>2016-11-28 15:04:20 -0500
commit316b24e0a093b8e05ff27e189b896187b4a31bfa (patch)
treedf36189b5058fb61475cbfb45dc3ce86f785ccb8 /gtk/gtkscalebutton.c
parent3efbb756198101af02caed19b29e9d0b129268d1 (diff)
downloadgtk+-316b24e0a093b8e05ff27e189b896187b4a31bfa.tar.gz
Fix reference handling in GtkScaleButton
We were leaking the adjustment, since we confuse ourselves with a property whose initial value comes out of a template. Stop doing that. https://bugzilla.gnome.org/show_bug.cgi?id=775212
Diffstat (limited to 'gtk/gtkscalebutton.c')
-rw-r--r--gtk/gtkscalebutton.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gtk/gtkscalebutton.c b/gtk/gtkscalebutton.c
index 81a689ef26..27d668ac5e 100644
--- a/gtk/gtkscalebutton.c
+++ b/gtk/gtkscalebutton.c
@@ -334,7 +334,6 @@ gtk_scale_button_class_init (GtkScaleButtonClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GtkScaleButton, box);
gtk_widget_class_bind_template_child_private (widget_class, GtkScaleButton, scale);
gtk_widget_class_bind_template_child_private (widget_class, GtkScaleButton, image);
- gtk_widget_class_bind_template_child_private (widget_class, GtkScaleButton, adjustment);
gtk_widget_class_bind_template_callback (widget_class, cb_button_press);
gtk_widget_class_bind_template_callback (widget_class, cb_button_release);
@@ -362,7 +361,9 @@ gtk_scale_button_init (GtkScaleButton *button)
gtk_popover_set_relative_to (GTK_POPOVER (priv->dock), GTK_WIDGET (button));
/* Need a local reference to the adjustment */
- g_object_ref (priv->adjustment);
+ priv->adjustment = gtk_adjustment_new (0, 0, 100, 2, 20, 0);
+ g_object_ref_sink (priv->adjustment);
+ gtk_range_set_adjustment (GTK_RANGE (priv->scale), priv->adjustment);
gtk_widget_add_events (GTK_WIDGET (button), GDK_SMOOTH_SCROLL_MASK);