mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-09-09 06:55:37 +00:00
x11: Clear the internal selection data when updating the clipboard
Clear the internal X11 clipboard selection data when updating the clipboard during SelectionNotify events, as it is invalid after the update. Otherwise, an out-of-date SelectionRequest can end up attempting to read the invalid data, and cause a crash.
This commit is contained in:
@@ -947,6 +947,9 @@ static void X11_HandleClipboardEvent(SDL_VideoDevice *_this, const XEvent *xeven
|
||||
new_mime_types[length] = NULL;
|
||||
|
||||
SDL_SendClipboardUpdate(false, new_mime_types, length);
|
||||
|
||||
// Clear the internal selection source data, as it was invalided after updating the clipboard.
|
||||
SDL_zero(videodata->clipboard);
|
||||
}
|
||||
|
||||
if (data) {
|
||||
|
||||
Reference in New Issue
Block a user