summaryrefslogtreecommitdiff
path: root/src/render/gl.cpp
diff options
context:
space:
mode:
authoraura <nw@moneybot.cc>2026-07-28 19:11:34 +0200
committeraura <nw@moneybot.cc>2026-07-28 19:11:34 +0200
commit86d248ed2b033fe36ce53b0387b2cbdcb69c0b72 (patch)
treea70f32a0f44b927a6d137998efa405e330689c0f /src/render/gl.cpp
parent468813b133a6a3ff0b85d3b34f1009cfeae815e4 (diff)
finish undo/redo
Diffstat (limited to 'src/render/gl.cpp')
-rw-r--r--src/render/gl.cpp9
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 );
}