Skip to content

Commit

Permalink
Fix assertion when switching to mod via menu, #458
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
DanielGibson committed May 24, 2022
1 parent 77e70b5 commit b88b99f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion neo/renderer/RenderSystem_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit b88b99f

Please sign in to comment.