Commit 88ed5af5 authored by Matthias Clasen's avatar Matthias Clasen

Use g_signal_connect_object for adjustments in GtkSpinButtonAccessible

An instance of GtkAdjustment may be used by another instance after
the spin button widget is destroyed. In that case, the function
gtk_spin_button_accessible_value_changed() will be called with an
invalid argument. This situation is often caused when one use
GtkCellRendererSpin widget. To avoid invalid call of the function,
the signal handler for the "value-changed" signal should be disconnected
when the spin-button widget is destroyed.
Using g_signal_connect_object achieves just that.
parent cbce9062
......@@ -51,10 +51,10 @@ gtk_spin_button_accessible_initialize (AtkObject *obj,
adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (data));
if (adjustment)
g_signal_connect (adjustment,
G_CALLBACK (gtk_spin_button_accessible_value_changed),
g_signal_connect_object (adjustment,
G_CALLBACK (gtk_spin_button_accessible_value_changed),
obj, 0);
......@@ -71,9 +71,9 @@ gtk_spin_button_accessible_notify_gtk (GObject *obj,
GtkAdjustment* adjustment;
adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget));
g_signal_connect (adjustment, "value-changed",
G_CALLBACK (gtk_spin_button_accessible_value_changed),
g_signal_connect_object (adjustment, "value-changed",
G_CALLBACK (gtk_spin_button_accessible_value_changed),
spin_button, 0);
GTK_WIDGET_ACCESSIBLE_CLASS (gtk_spin_button_accessible_parent_class)->notify_gtk (obj, pspec);
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