From 86d248ed2b033fe36ce53b0387b2cbdcb69c0b72 Mon Sep 17 00:00:00 2001 From: aura Date: Tue, 28 Jul 2026 19:11:34 +0200 Subject: finish undo/redo --- src/render/gl.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/render/gl.cpp') 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 ); } -- cgit v1.2.3