瀏覽代碼

wayland: Check the relative pointer handle before destroying

If the relative protocol is unsupported, this will always be null and the destroy function won't be called.
Frank Praznik 2 年之前
父節點
當前提交
0e87b71d08
共有 1 個文件被更改,包括 4 次插入 和 2 次删除
  1. 4 2
      src/video/wayland/SDL_waylandevents.c

+ 4 - 2
src/video/wayland/SDL_waylandevents.c

@@ -2989,8 +2989,10 @@ int Wayland_input_unlock_pointer(struct SDL_WaylandInput *input)
         w->locked_pointer = NULL;
         w->locked_pointer = NULL;
     }
     }
 
 
-    zwp_relative_pointer_v1_destroy(input->relative_pointer);
-    input->relative_pointer = NULL;
+    if (input->relative_pointer) {
+        zwp_relative_pointer_v1_destroy(input->relative_pointer);
+        input->relative_pointer = NULL;
+    }
 
 
     d->relative_mouse_mode = 0;
     d->relative_mouse_mode = 0;