SDL VERSION: 2.0.12
OS: Windows 10 Professional 17763.1518
ERROR Message: “Couldn’t find monitor data”
My application uses SDL2 to create a window for rendering video. The window disappears after I switch from windowed mode to fullscreen with calling SDL_SetWindowFullscreen and SDL_GetError() prints “Couldn’t find monitor data”. The error ALWAYS and ONLY occurs when I change the status of my monitors like turn-on and turn-off or switching from multi displays to single display.
The ERROR message is found in SDL_windowsmode.c when SDL tries to call System API GetMonitorInfo().
It seems SDL2 is not able to handle with the situation where the state of a physical monitor is changed(e.g. turn on/turn off or extending screen);p
However, If there are any misuses of SDL functions, please share your proper example with me. I would be very grateful.
Basic logic of my application
// Init my window when my event loop receives a STARTMIRRO event SDL_CreateWindow(); SDL_CreateRender(); SDL_CreateTexture(); // When my event loop receives a AVFrame SDL_UpdateYUVTexture(my_texture, NULL, ...); SDL_RenderClear(my_renderer); SDL_RenderCopy(my_renderer, my_texture); SDL_RenderPresent(my_renderer); // When my event loop receives a FULLSCREEN event SDL_SetWindowFullscreen(my_window, mode); // SDL_GetError() prints "Couldn't found monitor data" three times
An issue in Github is opend here: [BUG] "Couldn't find monitor data" error when reopening monitor · Issue #4251 · libsdl-org/SDL · GitHub