SDL
SDL copied to clipboard
Sudden death by X_ShmAttach when running over ssh
I'm developing a new program on GNU/Linux using SDL2 for graphics, but when I run it over ssh -X the program suddenly dies on startup with exit status 1 saying:
X Error of failed request: BadRequest (invalid request code or no such operation)
Major opcode of failed request: 130 (MIT-SHM)
Minor opcode of failed request: 1 (X_ShmAttach)
Serial number of failed request: 214
Current serial number in output stream: 215
It turns out that it's dying inside SDL_GetWindowSurface() the first time that is called, and exiting with status 1, rather than returning a failure code and letting the program fail more gracefully. At present my program does pixel access by getting the surface's memory and poking into it inside a SDL_Lock/UnlockSurface() pair. I assume that's impossible when the display and program are on different machines and was hoping to use a different SDL primitive in that scenario, although the EFL port of the same program works fine in those conditions. Either way, it would be nicer if SDL_GetWindowSurface() were to fail rather than bombing out.