summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ã…dahl <jadahl@gmail.com>2015-10-06 14:30:28 +0800
committerMatthias Clasen <mclasen@redhat.com>2015-10-12 13:23:31 -0400
commitcbc8d4a88a1717b8ad297772b8ab040c1072f5df (patch)
treebc03fc6c6661425889a86db032888797cfe54af9
parentda2f672c11eceee52eb5160d914f35d14a04d711 (diff)
downloadgtk+-cbc8d4a88a1717b8ad297772b8ab040c1072f5df.tar.gz
wayland: Don't ignore wl_keyboard.leave if surface is gone
keyboard_handle_leave() might be called with a NULL surface resource (for example if the surface was destroyed after the event was sent). If so, we should still deal with the keyboard focus lost event, otherwise we will both leak (the keyboard_focus GdkWindow reference) and miss stopping the key repeat timer. https://bugzilla.gnome.org/show_bug.cgi?id=755927
-rw-r--r--gdk/wayland/gdkdevice-wayland.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 92548858c1..b6e3fd0193 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -1191,15 +1191,14 @@ keyboard_handle_leave (void *data,
GdkEvent *event;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (device->display);
- if (!surface)
- return;
-
- if (!GDK_IS_WINDOW (wl_surface_get_user_data (surface)))
- return;
-
if (!device->keyboard_focus)
return;
+ /* gdk_window_is_destroyed() might already return TRUE for
+ * device->keyboard_focus here, which would happen if we destroyed the
+ * window before loosing keyboard focus.
+ */
+
stop_key_repeat (device);
_gdk_wayland_display_update_serial (display, serial);