libsdl-org / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
9.86k stars 1.83k forks source link

`SDL_GetClipboardData` can return stale data #9587

Open Susko3 opened 6 months ago

Susko3 commented 6 months ago

Repro steps (for Windows)

  1. Store some data with SDL_SetClipboardData with mime type image/png (it doesn't reproduce with image/bmp)
  2. In another application, copy some data. Could be a BMP image or some text.
    • calling SDL_SetClipboardText doesn't reproduce it
  3. Call SDL_HasClipboardData with image/png → notice that it returns SDL_TRUE
  4. Call SDL_GetClipboardData → notice that you get your original data back, even though logically, the clipboard should only have the other application's data
Green-Sky commented 6 months ago

This is more or less a duplicate of https://github.com/libsdl-org/SDL/issues/8338 . Nice to have more eyes on this :)

Susko3 commented 6 months ago

Not really a duplicate, yours only involves externally setting the clipboard, while this one mixes internal and external.