From 9c343681c4b7149798d3eac33ac41343edcd3def Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 27 May 2015 18:54:06 -0400 Subject: [PATCH] Wayland: Avoid NULL dereference after window destruction (thanks, "x414e54"!). Fixes Bugzilla #2934. --- src/video/wayland/SDL_waylandevents.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 6606dea039b23..3288d603314f4 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -293,6 +293,12 @@ keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, struct wl_array *keys) { struct SDL_WaylandInput *input = data; + + if (!surface) { + /* enter event for a window we've just destroyed */ + return; + } + SDL_WindowData *window = wl_surface_get_user_data(surface); input->keyboard_focus = window;