devkitPro / pacman-packages

https://devkitpro.org
131 stars 104 forks source link

[SDL_gfx] `rotateSurface90Degrees` returns a locked surface #331

Closed mardy closed 9 months ago

mardy commented 9 months ago

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().

I'm reporting this just to share the knowledge, in case someone bumps into this issue. I'm not sure if it's worth to write a patch for this. In any case, I've filed an upstream issue too: https://sourceforge.net/p/sdlgfx/bugs/16/ (assuming that the project is still alive)

WinterMute commented 9 months ago

Patched Wii & Gamecube packages pending update from upstream.

mardy commented 9 months ago

Hi Dave, could you please update the package to 2.0.27? The fix has been released (there's also another fix in the release :-) ).