From 52efefca0450758848859b67c14fd853e3ddcf4d Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Sat, 9 Sep 2023 18:37:49 -0400
Subject: [PATCH] wayland: Fix drag offer leak
The data device leave function is intended for drag offers, not selections, and the function as was previously written was a no-op.
---
src/video/wayland/SDL_waylandevents.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c
index 5a14655eaf86..90e4584a5d8f 100644
--- a/src/video/wayland/SDL_waylandevents.c
+++ b/src/video/wayland/SDL_waylandevents.c
@@ -1877,11 +1877,10 @@ static void data_device_handle_enter(void *data, struct wl_data_device *wl_data_
static void data_device_handle_leave(void *data, struct wl_data_device *wl_data_device)
{
SDL_WaylandDataDevice *data_device = data;
- SDL_WaylandDataOffer *offer = NULL;
- if (data_device->selection_offer != NULL) {
- data_device->selection_offer = NULL;
- Wayland_data_offer_destroy(offer);
+ if (data_device->drag_offer != NULL) {
+ Wayland_data_offer_destroy(data_device->drag_offer);
+ data_device->drag_offer = NULL;
}
}