Fix assertion when switching to mod via menu, #458

The assertion that triggered was "assert(iconvDesc == (SDL_iconv_t)-1);"
in Sys_InitInput() - because when loading a mod the window is recreated,
calling Com_ReloadEngine_f() -> idCommonLocal::InitGame()
 -> idCommonLocal::InitRenderSystem() -> idCommonLocal::InitOpenGL()
 -> R_InitOpenGL() -> Sys_InitInput()

Before that Com_ReloadEngine_f() calls commonLocal.ShutdownGame( true );
which calls the equivalent Shutdown() functions - except so far no one
called Sys_ShutdownInput() (which closes iconvDesc and resets it to -1).
Fixed that by making idRenderSystemLocal::ShutdownOpenGL() call it.
This commit is contained in:
Daniel Gibson 2022-05-24 03:32:55 +02:00
parent 77e70b5df7
commit b88b99fadb

View file

@ -2255,9 +2255,16 @@ idRenderSystemLocal::ShutdownOpenGL
========================
*/
void idRenderSystemLocal::ShutdownOpenGL( void ) {
// free the context and close the window
R_ShutdownFrameData();
// as the input is tied to the window, it should be shut down when the window
// is destroyed (relevant when starting a mod which also recreates window)
Sys_ShutdownInput();
// free the context and close the window
GLimp_Shutdown();
glConfig.isInitialized = false;
}