Jelajahi Sumber

Wayland: Avoid NULL dereference after window destruction (thanks, "x414e54"!).

Fixes Bugzilla #2934.
Ryan C. Gordon 10 tahun lalu
induk
melakukan
9c343681c4
1 mengubah file dengan 6 tambahan dan 0 penghapusan
  1. 6 0
      src/video/wayland/SDL_waylandevents.c

+ 6 - 0
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;