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

main
Frank Praznik 2023-09-26 11:22:01 -04:00
parent 4454dc400b
commit 9667aa18e6
1 changed files with 5 additions and 1 deletions

View File

@ -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);
}