SDL_DestroySurface(3)

πŸ’– SDL_DestroySurface β€” the manual page, bestie edition πŸ’–

okay so this is a page from the SDL3 FUNCTIONS manual, and today's main character is SDL_DestroySurface. she's the cleanup crew. the girl who takes out the trash after the party. and honestly? we're obsessed. πŸŽ€


✨ NAME ✨

SDL_DestroySurface β€” free a surface. that's it, that's the whole job. girlboss behaviour. πŸ’…


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_surface.h>

void SDL_DestroySurface(SDL_Surface *surface);

look at her. no return value, no drama, no notes. she just does it. πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so you've got a surface, you're done with it, and now you need to let it go. this is the function that does that. closure, literally. πŸ’–

and here's the part that lowkey slays: it is safe to pass NULL to this function. no crash, no panic, no "bestie why would you do that". she just handles it. so chill. so unbothered. ✨


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • surface β€” the SDL_Surface to free. hand her the surface, she handles the rest. 🫢

πŸ”₯ THREAD SAFETY πŸ”₯

No other thread should be using the surface when it is freed.

fr fr, this one matters. if some other thread is still touching that surface while you're freeing it, that's a vibe check you will NOT pass. make sure everybody's done with it first, then let it go. πŸ’€πŸš«


🌈 AVAILABILITY 🌈

this function has been available since SDL 3.2.0. so if you're on 3.2.0 or later, she's there for you. iconic since day one. ⭐


πŸ’œ SEE ALSO πŸ’œ


and that's the whole page, no cap. go forth and free your surfaces responsibly. 🌸

Simple Directmedia Layer β€” SDL 3.4.18 β€” mwah, love you, bye bestie πŸ’‹πŸ’– SDL_DestroySurface(3)

πŸ“¦ where this page comes from