From 4677f4050e5fa5044e8e06928675a3e3d3bf763f Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 7 Dec 2025 15:16:58 +0100 Subject: sokol_gfx.h: protect sg_setup and sg_shutdown from being called twice (fixes #1378) --- sokol_gfx.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sokol_gfx.h') diff --git a/sokol_gfx.h b/sokol_gfx.h index 18d0692c..b78e6999 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -24553,6 +24553,7 @@ _SOKOL_PRIVATE void _sg_override_portable_limits(void) { // // >>public SOKOL_API_IMPL void sg_setup(const sg_desc* desc) { + SOKOL_ASSERT(!_sg.valid); SOKOL_ASSERT(desc); SOKOL_ASSERT((desc->_start_canary == 0) && (desc->_end_canary == 0)); SOKOL_ASSERT((desc->allocator.alloc_fn && desc->allocator.free_fn) || (!desc->allocator.alloc_fn && !desc->allocator.free_fn)); @@ -24568,6 +24569,7 @@ SOKOL_API_IMPL void sg_setup(const sg_desc* desc) { } SOKOL_API_IMPL void sg_shutdown(void) { + SOKOL_ASSERT(_sg.valid); _sg_discard_all_resources(); _sg_discard_backend(); _sg_discard_commit_listeners(); -- cgit v1.2.3