diff options
Diffstat (limited to 'src/render/gl.cpp')
| -rw-r--r-- | src/render/gl.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/render/gl.cpp b/src/render/gl.cpp index 6ab2117..7425ff4 100644 --- a/src/render/gl.cpp +++ b/src/render/gl.cpp @@ -241,9 +241,9 @@ void gl_gen_buffers( GL_DATA* gl ) { void gl_destroy( GL_DATA *gl ) { SDL_SetEventFilter( 0, 0 ); - gl->programs.each( fn( GL_SHADER_PROGRAM** it ) { gl_program_destroy( gl, *it ); } ); - gl->fonts.each( fn( GL_FONT** it ) { gl_font_destroy( gl, *it ); } ); - gl->textures.each( fn( GL_TEX2D** it ) { gl_texture_destroy( gl, *it ); } ); + while( gl->programs.size ) { gl_program_destroy( gl, gl->programs.pop() ); } + while( gl->fonts.size ) { gl_font_destroy( gl, gl->fonts.pop() ); } + while( gl->textures.size ) { gl_texture_destroy( gl, gl->textures.pop() ); } if( gl->ctx ) SDL_GL_DeleteContext( gl->ctx ); @@ -407,6 +407,9 @@ void gl_program_destroy( GL_DATA* gl, GL_SHADER_PROGRAM* program ) { if( program->vsh.compiled ) gl_shader_destroy( gl, &program->vsh ); + I32 idx = gl->programs.idx_of( program ); + gl->programs.erase( idx ); + free( program ); } |
