SDL_SetPoint...tyWithCleanup(3)
β¨ SDL_SetPointerPropertyWithCleanup β¨
okay bestie, so this one lives in the SDL3 FUNCTIONS part of the manual, and the page header is literally SDL_SetPoint...tyWithCleanup(3) because the name is so long the terminal had to squish it π. Anyway. We're setting a pointer property in a group of properties, and we're attaching a cleanup function that gets called when that property gets deleted. It's giving β¨responsible ownershipβ¨.
πΈ NAME πΈ
SDL_SetPointerPropertyWithCleanup β set a pointer property in a group of properties, with a cleanup function that gets called when the property is deleted. π
π¦ SYNOPSIS π¦
#include <SDL3/SDL_properties.h>
bool SDL_SetPointerPropertyWithCleanup(SDL_PropertiesID props, const char *name, void *value, SDL_CleanupPropertyCallback cleanup, void *userdata);
π DESCRIPTION π
So the tea is: that cleanup function also gets called if setting the property fails for any reason. Yes, any reason. She's committed. π
Now listen β if you're just setting basic data types, like numbers, bools, or strings, please use SDL_SetNumberProperty, SDL_SetBooleanProperty, or SDL_SetStringProperty instead, because those functions will handle cleanup on your behalf, no cap. This function right here is only for more complex, custom data. It's the main character function for main character data π.
π FUNCTION PARAMETERS π
propsβ the properties to modify. your little property group, your canvas π«Άnameβ the name of the property to modify. like, the label on the box πvalueβ the new value of the property, orNULLto delete the property. yep,NULL= delete, that's the move ποΈcleanupβ the function to call when this property is deleted, orNULLif no cleanup is necessary. if you got nothing to clean, passNULLand vibe β¨userdataβ a pointer that is passed to the cleanup function. your little gift basket for the cleanup function π
π₯ RETURN VALUE π₯
Returns true on success or false on failure. If it fails, call SDL_GetError() for more information β she will tell you what went wrong, fr fr π
π THREAD SAFETY π
It is safe to call this function from any thread. multi-threaded queen behavior, we love to see it π
β AVAILABILITY β
This function is available since SDL 3.2.0. so if you're on something older... girl. upgrade. π
π SEE ALSO π
and that's the whole page, bestie!! this was brought to you by Simple Directmedia Layer, rocking SDL 3.4.18 β go off, you got this π β¨π¦
π¦ 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