[gtk+] Use g_signal_connect_object for adjustments in GtkSpinButtonAccessible



commit 88ed5af5e444dcf8ca874fc9b8dfcf3fd35c5a03
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jan 20 22:16:47 2013 -0500

    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.
    https://bugzilla.gnome.org/show_bug.cgi?id=691592

 gtk/a11y/gtkspinbuttonaccessible.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/gtk/a11y/gtkspinbuttonaccessible.c b/gtk/a11y/gtkspinbuttonaccessible.c
index d344f4e..48c84ec 100644
--- a/gtk/a11y/gtkspinbuttonaccessible.c
+++ b/gtk/a11y/gtkspinbuttonaccessible.c
@@ -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,
-                      "value-changed",
-                      G_CALLBACK (gtk_spin_button_accessible_value_changed),
-                      obj);
+    g_signal_connect_object (adjustment,
+                             "value-changed",
+                             G_CALLBACK (gtk_spin_button_accessible_value_changed),
+                             obj, 0);
 
   obj->role = ATK_ROLE_SPIN_BUTTON;
 }
@@ -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),
-                        spin_button);
+      g_signal_connect_object (adjustment, "value-changed",
+                               G_CALLBACK (gtk_spin_button_accessible_value_changed),
+                               spin_button, 0);
     }
   else
     GTK_WIDGET_ACCESSIBLE_CLASS (gtk_spin_button_accessible_parent_class)->notify_gtk (obj, pspec);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]