Skip to content

st/oxr: Initialize sdl on main thread

Christoph Haag requested to merge christoph/sdl_init_mainthread into master

Calling SDL_Init() in different threads in the same process crashes.

In this SDL2 code X11_XOpenDisplay() will be a null pointer on the second thread;

if (SDL_X11_LoadSymbols()) {
    display = X11_XOpenDisplay(NULL);

This becomes a problem when monado starts the debug UI in a thread, and then an OpenXR client application tries to initialize SDL.

Two consecutive SDL_Init() in the same thread is harmless though.

Merge request reports