aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorAndre Weissflog <floooh@gmail.com>2024-03-14 18:45:54 +0100
committerAndre Weissflog <floooh@gmail.com>2024-03-14 18:45:54 +0100
commitdd00e4d3a5af2461e117f714ee8fce432fc37c2f (patch)
tree7e9db25397c8ac5f2ea1c7f802f375588aee98ff /util
parentdb32cf409a9eb984e1ababa96e243f141c7f40ed (diff)
sokol_imgui.h: assert against texture leakage when calling simgui_create_fonts_texture()
Diffstat (limited to 'util')
-rw-r--r--util/sokol_imgui.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h
index 9c041eaf..a1cb10d2 100644
--- a/util/sokol_imgui.h
+++ b/util/sokol_imgui.h
@@ -2381,6 +2381,9 @@ SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) {
SOKOL_API_IMPL void simgui_create_fonts_texture(const simgui_font_tex_desc_t* desc) {
SOKOL_ASSERT(desc);
+ SOKOL_ASSERT(SG_INVALID_ID == _simgui.font_smp.id);
+ SOKOL_ASSERT(SG_INVALID_ID == _simgui.font_img.id);
+ SOKOL_ASSERT(SIMGUI_INVALID_ID == _simgui.default_font.id);
#if defined(__cplusplus)
ImGuiIO* io = &ImGui::GetIO();
@@ -2430,6 +2433,9 @@ SOKOL_API_IMPL void simgui_destroy_fonts_texture(void) {
sg_destroy_sampler(_simgui.font_smp);
sg_destroy_image(_simgui.font_img);
simgui_destroy_image(_simgui.default_font);
+ _simgui.font_smp.id = SG_INVALID_ID;
+ _simgui.font_img.id = SG_INVALID_ID;
+ _simgui.default_font.id = SIMGUI_INVALID_ID;
}
SOKOL_API_IMPL void simgui_shutdown(void) {