[nautilus] a11y: make sure not to loop while looking for parent get_accessible



commit f2c748dc0610272a8430d81f69156d3ae391fb18
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Jun 7 14:46:31 2012 -0400

    a11y: make sure not to loop while looking for parent get_accessible
    
    If the final class does not override the get_accessible method, it will
    inherit it from the parent class; what we're interested in is the first
    class for which get_accessible is != from our class get_accessible.

 eel/eel-accessibility.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/eel/eel-accessibility.c b/eel/eel-accessibility.c
index 62249c9..95cbdaa 100644
--- a/eel/eel-accessibility.c
+++ b/eel/eel-accessibility.c
@@ -118,13 +118,19 @@ eel_accessibility_create_accessible_gtype (const char *type_name,
 	GType atk_type, parent_atk_type;
 	GTypeQuery query;
 	AtkObject *parent_atk;
-	GtkWidgetClass *parent_class;
+	GtkWidgetClass *parent_class, *klass;
 
 	if ((atk_type = g_type_from_name (type_name))) {
 		return atk_type;
 	}
 
-	parent_class = g_type_class_peek_parent (G_OBJECT_GET_CLASS (widget));
+	klass = GTK_WIDGET_CLASS (G_OBJECT_GET_CLASS (widget));
+	parent_class = klass;
+
+	while (klass->get_accessible == parent_class->get_accessible) {
+		parent_class = g_type_class_peek_parent (parent_class);
+	}
+
 	parent_atk = parent_class->get_accessible (widget);
 	parent_atk_type = G_TYPE_FROM_INSTANCE (parent_atk);
 



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