From d0cfcf10bb68bdafc8b3cd09308f94adb68c4ecb Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 9 Oct 2025 11:25:56 -0700
Subject: [PATCH] Fixed crash getting clipboard data processing clipboard
events on X11
SDL_PumpEvents() was freeing the temporary memory in the clipboard event, so if the application was iterating over the mime types in the event and retrieving the clipboard data, it would crash after the first entry.
(cherry picked from commit 3c0a6c32d4a35b8030f54d84f6ee8e8badf0f4f9)
---
src/video/x11/SDL_x11clipboard.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/video/x11/SDL_x11clipboard.c b/src/video/x11/SDL_x11clipboard.c
index 5e33555f9a653..2cd42dc447188 100644
--- a/src/video/x11/SDL_x11clipboard.c
+++ b/src/video/x11/SDL_x11clipboard.c
@@ -139,7 +139,7 @@ static bool WaitForSelection(SDL_VideoDevice *_this, Atom selection_type, bool *
waitStart = SDL_GetTicks();
*flag = true;
while (*flag) {
- SDL_PumpEvents();
+ X11_PumpEvents(_this);
waitElapsed = SDL_GetTicks() - waitStart;
// Wait one second for a selection response.
if (waitElapsed > 1000) {