SDL_Cleanu...rtyCallback(3type)
π SDL_CleanupPropertyCallback π
okay bestie, so this one lives in the SDL3 DATATYPES section of the manual, and it's literally the lil callback you hand over when you want something cleaned up after a property gets yeeted. no cap. π§Ήβ¨
β¨ NAME β¨
SDL_CleanupPropertyCallback β a callback used to free resources when a property is deleted.
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_properties.h>
typedef void (SDLCALL *SDL_CleanupPropertyCallback)(void *userdata, void *value);
π¦ DESCRIPTION π¦
So basically: this is the function that goes "okay girl, time to let go" and releases any resources associated with value that are no longer needed. it's giving responsible. it's giving cleanup era. π
this callback is set per-property. like, different properties in the same group can have totally different cleanup callbacks, and that's iconic actually. each one does its own thing. π
and here's the part you need to clock: this callback will be called _during_ SDL_SetPointerPropertyWithCleanup if the function fails for any reason. not after, not whenever, during. iykyk. π«Ά
π FUNCTION PARAMETERS π
userdataβ an app-defined pointer that gets passed to the callback. it's yours, you brought it, you get it back. πvalueβ the pointer that was assigned to the property, and the thing you're cleaning up. bye bestie π«‘
π₯ THREAD SAFETY π₯
ngl this is the spicy part: this callback may fire without any locks held. so if that's a concern for you (and lowkey it might be), the app should provide its own locking. the callback is not gonna do it for you, it's not your mom. ππ
β AVAILABILITY β
this datatype has been available since SDL 3.2.0. she's new, she's fresh, she's here. π
πΈ SEE ALSO πΈ
SDL_SetPointerPropertyWithCleanup(3)β the function that goes with this whole vibe. go read it, fr fr. π
reminder bestie: this is a typedef, not a function you call yourself. you write the function, you hand it over, SDL does the rest. main character energy but make it plumbing. π
and that's the whole page!! brought to you by the legends over at Simple Directmedia Layer, straight out of SDL 3.4.18 π stay clean, stay cute, and clean up your properties. mwah!! πβ¨π¦
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms