a11y: Hack around infinite loops in parent setting

This is kind of a hack to get rid of infinite loops that occur when
child accessibles try to set their parent upon creation but the parent
accessible creates its children in the initialize vfunc. Because in that
case, the parent will not have an accessible set when the child tries to
access it, because it is still initializing itself. Which will cause a
new accessible to be created.

https://bugzilla.gnome.org/show_bug.cgi?id=660687
This commit is contained in:
Benjamin Otte 2011-10-03 17:05:40 +02:00 committed by Matthias Clasen
parent 7d165b67f9
commit b195c7dbb2

View File

@ -12088,19 +12088,27 @@ gtk_widget_real_get_accessible (GtkWidget *widget)
accessible =
atk_object_factory_create_accessible (factory,
G_OBJECT (widget));
if (priv->accessible_role != ATK_ROLE_INVALID)
atk_object_set_role (accessible, priv->accessible_role);
g_object_set_qdata (G_OBJECT (widget),
quark_accessible_object,
accessible);
}
else
{
accessible = g_object_new (priv->accessible_type, NULL);
if (priv->accessible_role != ATK_ROLE_INVALID)
atk_object_set_role (accessible, priv->accessible_role);
g_object_set_qdata (G_OBJECT (widget),
quark_accessible_object,
accessible);
atk_object_initialize (accessible, widget);
}
if (priv->accessible_role != ATK_ROLE_INVALID)
atk_object_set_role (accessible, priv->accessible_role);
g_object_set_qdata (G_OBJECT (widget),
quark_accessible_object,
accessible);
}
return accessible;
}