# HG changeset patch # User Michael Pavone # Date 1700723250 28800 # Node ID a8c069d847a094841f7d15fb0dc805e0369b76ab # Parent ff2f18dac84bc37178e9c57a8b561db69b8a104a Fix issue that would break debug windows when config update causes window to be recreated diff -r ff2f18dac84b -r a8c069d847a0 render_sdl.c --- a/render_sdl.c Wed Nov 22 22:59:57 2023 -0800 +++ b/render_sdl.c Wed Nov 22 23:07:30 2023 -0800 @@ -476,8 +476,10 @@ if (texture_init) { return; } - sdl_textures= calloc(sizeof(SDL_Texture *), 3); - num_textures = 3; + if (!sdl_textures) { + sdl_textures= calloc(sizeof(SDL_Texture *), 3); + num_textures = 3; + } texture_init = 1; #ifndef DISABLE_OPENGL if (render_gl) { @@ -1273,7 +1275,15 @@ void render_config_updated(void) { - free_surfaces(); + int n = num_textures < FRAMEBUFFER_USER_START ? num_textures : FRAMEBUFFER_USER_START; + for (int i = 0; i < n; i++) + { + if (sdl_textures[i]) { + SDL_DestroyTexture(sdl_textures[i]); + sdl_textures[i] = NULL; + } + } + texture_init = 0; #ifndef DISABLE_OPENGL if (render_gl) { if (on_context_destroyed) {