]> Pileus Git - ~andy/gtk/commitdiff
wayland: skip pointer and keyboard events without a surface
authorThomas Wood <thomas.wood@intel.com>
Thu, 7 Feb 2013 15:38:40 +0000 (15:38 +0000)
committerThomas Wood <thomas.wood@intel.com>
Tue, 12 Feb 2013 15:30:56 +0000 (15:30 +0000)
Pointer and keyboard events can be received after the surface has been
destroyed, in which case the surface will be NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=693338

gdk/wayland/gdkdevice-wayland.c

index bb4ef0bebf1e9c62a5f1376bec860fa5e0feee60..90ecb1777e3de9df98d6d23963ac019b9f53fd9b 100644 (file)
@@ -550,6 +550,9 @@ pointer_handle_enter (void              *data,
   GdkWaylandDisplay *wayland_display =
     GDK_WAYLAND_DISPLAY (device->display);
 
+  if (!surface)
+    return;
+
   _gdk_wayland_display_update_serial (wayland_display, serial);
 
   device->pointer_focus = wl_surface_get_user_data(surface);
@@ -589,6 +592,9 @@ pointer_handle_leave (void              *data,
   GdkWaylandDisplay *wayland_display =
     GDK_WAYLAND_DISPLAY (device->display);
 
+  if (!surface)
+    return;
+
   _gdk_wayland_display_update_serial (wayland_display, serial);
 
   event = gdk_event_new (GDK_LEAVE_NOTIFY);
@@ -777,6 +783,9 @@ keyboard_handle_enter (void               *data,
   GdkWaylandDisplay *wayland_display =
     GDK_WAYLAND_DISPLAY (device->display);
 
+  if (!surface)
+    return;
+
   _gdk_wayland_display_update_serial (wayland_display, serial);
 
   device->keyboard_focus = wl_surface_get_user_data(surface);
@@ -808,6 +817,9 @@ keyboard_handle_leave (void               *data,
   GdkWaylandDisplay *wayland_display =
     GDK_WAYLAND_DISPLAY (device->display);
 
+  if (!surface)
+    return;
+
   _gdk_wayland_display_update_serial (wayland_display, serial);
 
   _gdk_wayland_window_remove_focus (device->keyboard_focus);