a11y: Check whether a widget is mapped before querying its parent

Call gtk_widget_get_mapped() in a couple of places before looking at the
widget's parent, since it might be set to a widget that has been
finalized, causing an invalid read.
This commit is contained in:
Mike Gorse 2013-08-30 09:13:39 -05:00
parent 89214cad5b
commit 3f2aacca52

View File

@ -271,7 +271,7 @@ gtk_widget_accessible_ref_relation_set (AtkObject *obj)
label = find_label (widget);
if (label == NULL)
{
if (GTK_IS_BUTTON (widget))
if (GTK_IS_BUTTON (widget) && gtk_widget_get_mapped (widget))
/*
* Handle the case where GnomeIconEntry is the mnemonic widget.
* The GtkButton which is a grandchild of the GnomeIconEntry
@ -781,6 +781,9 @@ gtk_widget_accessible_on_screen (GtkWidget *widget)
gtk_widget_get_allocation (widget, &allocation);
if (!gtk_widget_get_mapped (widget))
return FALSE;
viewport = gtk_widget_get_ancestor (widget, GTK_TYPE_VIEWPORT);
if (viewport)
{