瀏覽代碼

Fixed wayland cursor use-after-free at shutdown

Sam Lantinga 10 月之前
父節點
當前提交
b9d018f2a2
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      src/video/wayland/SDL_waylandmouse.c

+ 7 - 0
src/video/wayland/SDL_waylandmouse.c

@@ -598,6 +598,13 @@ static SDL_Cursor *Wayland_CreateDefaultCursor(void)
 
 
 static void Wayland_FreeCursorData(SDL_CursorData *d)
 static void Wayland_FreeCursorData(SDL_CursorData *d)
 {
 {
+    SDL_VideoDevice *vd = SDL_GetVideoDevice();
+    struct SDL_WaylandInput *input = vd->internal->input;
+
+    if (input->current_cursor == d) {
+        input->current_cursor = NULL;
+    }
+
     // Buffers for system cursors must not be destroyed.
     // Buffers for system cursors must not be destroyed.
     if (d->is_system_cursor) {
     if (d->is_system_cursor) {
         if (d->cursor_data.system.frame_callback) {
         if (d->cursor_data.system.frame_callback) {