aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--types/wlr_data_device_manager.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/types/wlr_data_device_manager.c b/types/wlr_data_device_manager.c
index d5a6cca9..a813754c 100644
--- a/types/wlr_data_device_manager.c
+++ b/types/wlr_data_device_manager.c
@@ -33,6 +33,10 @@ static void data_device_start_drag(struct wl_client *client,
static void data_device_set_selection(struct wl_client *client,
struct wl_resource *resource, struct wl_resource *source_resource,
uint32_t serial) {
+ if (!source_resource) {
+ return;
+ }
+
// TODO: serial validation
struct wlr_seat_handle *handle = wl_resource_get_user_data(resource);
struct wlr_data_device *device = handle->wlr_seat->data_device;
@@ -176,6 +180,10 @@ void wlr_data_device_manager_destroy(struct wlr_data_device_manager *manager) {
void wlr_data_device_set_selection(struct wlr_data_device *device,
struct wlr_data_source *source) {
+ if (device->selection == source) {
+ return;
+ }
+
if (device->selection) {
wl_list_remove(&device->selection_destroyed.link);
wlr_data_source_cancelled(device->selection);