Browse Source

wayland: Check that the data device supports the release method before calling it

Frank Praznik 1 year ago
parent
commit
9667aa18e6
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/video/wayland/SDL_waylandevents.c

+ 5 - 1
src/video/wayland/SDL_waylandevents.c

@@ -2759,7 +2759,11 @@ void Wayland_display_destroy_input(SDL_VideoData *d)
             Wayland_data_offer_destroy(input->data_device->drag_offer);
         }
         if (input->data_device->data_device != NULL) {
-            wl_data_device_release(input->data_device->data_device);
+            if (wl_data_device_get_version(input->data_device->data_device) >= WL_DATA_DEVICE_RELEASE_SINCE_VERSION) {
+                wl_data_device_release(input->data_device->data_device);
+            } else {
+                wl_data_device_destroy(input->data_device->data_device);
+            }
         }
         SDL_free(input->data_device);
     }