`rotateSurface90Degrees` returns a locked surface
Brought to you by:
ferzkopp
I just spent several hours debugging an issue with SDL, and finally discovered a bug in SDL_gfx: the function rotateSurface90Degrees() has a copy&paste error in its implementation, which causes it to lock the returned surface twice:
if (SDL_MUSTLOCK(dst)) {
SDL_LockSurface(dst);
}
if (SDL_MUSTLOCK(dst)) {
SDL_LockSurface(dst);
}
(you can find this code here). Indeed, the author wanted to lock dst only once, and then to lock src. The end of the function has the respective calls to SDL_UnlockSurface().
Thanks for the report.
Is this the canonical source for SDL_gfx? I found some copies on github as well.
Mainly asking because we're using this for wii & gamecube & Alberto reported this at https://github.com/devkitPro/pacman-packages/issues/331 as well. I'll patch it for us for now but would obvious prefer to be using upstream if possible.
Patch, if it helps.
Thanks for the patch. It may take me some time to get around to make a new release as this code is rather old.
Made a 2.0.27 release with this fix. Please check if that works for you.
Last edit: ferzkopp 2023-12-11