gesture: Protect against odd window hierarchies

If no match is found with the gesture widget when poking the event
window parents, bail out safely instead of falling in an infinite
loop. This was seen on Mutter.
This commit is contained in:
Carlos Garnacho
2014-04-28 12:53:36 +02:00
parent cbe47c02a1
commit d9e6395ee9

View File

@ -318,7 +318,7 @@ _update_widget_coordinates (GtkGesture *gesture,
gdk_event_get_coords (data->event, &event_x, &event_y);
window = data->event->any.window;
while (window != event_widget_window)
while (window && window != event_widget_window)
{
gdk_window_get_position (window, &wx, &wy);
event_x += wx;
@ -326,6 +326,9 @@ _update_widget_coordinates (GtkGesture *gesture,
window = gdk_window_get_effective_parent (window);
}
if (!window)
return;
if (!gtk_widget_get_has_window (event_widget))
{
gtk_widget_get_allocation (event_widget, &allocation);