#1315·sokol

sokol_gfx.h: maybe make sg_destroy calls with an invalid handle an error.

Author: flooohCreated Aug 17, 2025Updated Aug 10, 2026
Labelssokol-gfx

With the view update there's the following 'loophole' when destroying a view and its associated image:

c
sg_destroy_view(view);
sg_destroy_image(sg_query_view_image(view));

The sg_destroy_image call will be a silent no-op because sg_query_view_image() returns an invalid handle.

Maybe at least log an error or warning when the sg_destroy_* funcs are called with an SG_INVALID_ID handle. This dials back some of the 'convenience' but might at least avoid a resource leak.

PS: maybe better solution: sg_query_view_image() should warn or fail hard when callied with a stale view handle.