[gtk+/gestures: 127/202] gesture: Protect against odd window hierarchies



commit d9e6395ee98c5c34ff414aa83638b096693b2def
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Apr 28 12:53:36 2014 +0200

    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.

 gtk/gtkgesture.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkgesture.c b/gtk/gtkgesture.c
index e1f03d8..30d944a 100644
--- a/gtk/gtkgesture.c
+++ b/gtk/gtkgesture.c
@@ -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);


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