a11y: handle atk race condition where widget has been destroyed

If the widget has been destroyed since a DBus message had been sent,
we could be in a condition that the widget pointer exists but it does
not have a window.

This bails as if the widget didn't exist if there is no available
GdkWindow.

We also set the extents to 0 to be defensive since this is a vfunc
implementation.

https://bugzilla.gnome.org/show_bug.cgi?id=746586
This commit is contained in:
Christian Hergert 2015-03-21 14:17:39 -07:00 committed by Matthias Clasen
parent 9e9c0a133e
commit 7bb3d9557f

View File

@ -509,6 +509,11 @@ gtk_text_view_accessible_get_character_extents (AtkText *text,
GdkWindow *window;
gint x_widget, y_widget, x_window, y_window;
*x = 0;
*y = 0;
*width = 0;
*height = 0;
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
if (widget == NULL)
return;
@ -519,6 +524,9 @@ gtk_text_view_accessible_get_character_extents (AtkText *text,
gtk_text_view_get_iter_location (view, &iter, &rectangle);
window = gtk_text_view_get_window (view, GTK_TEXT_WINDOW_WIDGET);
if (window == NULL)
return;
gdk_window_get_origin (window, &x_widget, &y_widget);
*height = rectangle.height;