mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-04 13:04:41 +00:00
Fix property cleanup callback not being called on error (#9663)
The documentation for `SDL_SetPropertyWithCleanup` mentions that the cleanup function is called upon failure. But this wasn't working in the code.
This commit is contained in:
@@ -274,7 +274,6 @@ static int MEDIAFOUNDATION_AcquireFrame(SDL_CameraDevice *device, SDL_Surface *f
|
||||
frame->pixels = pixels;
|
||||
frame->pitch = (int) pitch;
|
||||
if (SDL_SetPropertyWithCleanup(surfprops, PROP_SURFACE_IMFOBJS_POINTER, objs, CleanupIMF2DBuffer2, NULL) == -1) {
|
||||
CleanupIMF2DBuffer2(NULL, objs);
|
||||
retval = -1;
|
||||
}
|
||||
}
|
||||
@@ -287,7 +286,6 @@ static int MEDIAFOUNDATION_AcquireFrame(SDL_CameraDevice *device, SDL_Surface *f
|
||||
frame->pixels = pixels;
|
||||
frame->pitch = (int) pitch;
|
||||
if (SDL_SetPropertyWithCleanup(surfprops, PROP_SURFACE_IMFOBJS_POINTER, objs, CleanupIMF2DBuffer, NULL) == -1) {
|
||||
CleanupIMF2DBuffer(NULL, objs);
|
||||
retval = -1;
|
||||
}
|
||||
}
|
||||
@@ -305,7 +303,6 @@ static int MEDIAFOUNDATION_AcquireFrame(SDL_CameraDevice *device, SDL_Surface *f
|
||||
frame->pixels = pixels;
|
||||
frame->pitch = (int) pitch;
|
||||
if (SDL_SetPropertyWithCleanup(surfprops, PROP_SURFACE_IMFOBJS_POINTER, objs, CleanupIMFMediaBuffer, NULL) == -1) {
|
||||
CleanupIMFMediaBuffer(NULL, objs);
|
||||
retval = -1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user