Simplified SDL_SetProperty() and added SDL_SetPropertyWithCleanup()

Most of the time people won't need to set a cleanup callback, so we can simplify the more commonly used API.
This commit is contained in:
Sam Lantinga 2023-11-07 12:33:43 -08:00
parent a1941fad6c
commit aea6e6de6f
16 changed files with 61 additions and 34 deletions

View file

@ -464,7 +464,7 @@ static SDL_bool GetTextureForMemoryFrame(AVFrame *frame, SDL_Texture **texture)
SDL_OutOfMemory();
return SDL_FALSE;
}
SDL_SetProperty(props, SWS_CONTEXT_CONTAINER_PROPERTY, sws_container, FreeSwsContextContainer, NULL);
SDL_SetPropertyWithCleanup(props, SWS_CONTEXT_CONTAINER_PROPERTY, sws_container, FreeSwsContextContainer, NULL);
}
sws_container->context = sws_getCachedContext(sws_container->context, frame->width, frame->height, frame->format, frame->width, frame->height, AV_PIX_FMT_BGRA, SWS_POINT, NULL, NULL, NULL);
if (sws_container->context) {