Commit 17ec4f10 authored by Matthias Clasen's avatar Matthias Clasen

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
parent cf4fd0d3
......@@ -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);
......
......@@ -15,11 +15,6 @@
</object>
</child>
</template>
<object class="GtkAdjustment" id="adjustment">
<property name="upper">100</property>
<property name="step-increment">2</property>
<property name="page-increment">20</property>
</object>
<object class="GtkPopover" id="dock">
<signal name="map" handler="cb_popup_mapped" swapped="no"/>
<style>
......@@ -63,7 +58,6 @@
<property name="visible">1</property>
<property name="can-focus">1</property>
<property name="orientation">vertical</property>
<property name="adjustment">adjustment</property>
<property name="inverted">1</property>
<property name="round-digits">1</property>
<property name="draw-value">0</property>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment