Skip to content

Commit

Permalink
Fix opengl context leak on vid_restart (causing thread, memory and ot…
Browse files Browse the repository at this point in the history
…her resource leaks)

SDL opengl context must be destroyed before destroying its window and
also before SDL_QuitSubSystem(SDL_INIT_VIDEO) to prevent leaks
  • Loading branch information
aufau committed May 1, 2024
1 parent 2815211 commit 3f4ca6b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion shared/sdl/sdl_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -810,8 +810,17 @@ void WIN_Shutdown( void )

IN_Shutdown();

if ( opengl_context ) {
SDL_GL_DeleteContext( opengl_context );
opengl_context = NULL;
}

if ( screen ) {
SDL_DestroyWindow( screen );
screen = NULL;
}

SDL_QuitSubSystem( SDL_INIT_VIDEO );
screen = NULL;
}

void GLimp_EnableLogging( qboolean enable )
Expand Down

0 comments on commit 3f4ca6b

Please sign in to comment.