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) (#194)

SDL opengl context must be destroyed before destroying its window and
also before SDL_QuitSubSystem(SDL_INIT_VIDEO) to prevent leaks

(cherry picked from commit 3f4ca6b)

Co-authored-by: fau <[email protected]>
  • Loading branch information
taysta and aufau authored May 2, 2024
1 parent 13eac34 commit 94f80f0
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 @@ -858,8 +858,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 94f80f0

Please sign in to comment.