I think there’s an RLE bug in SDL with
Functions like SDL_LockSurface, and SDL_MUSTLOCK use
SDL_SetSurfaceRLE doesn’t update
surface->flags , only the internal
SDL_SetSurfaceRLE(surf, SDL_TRUE); assert (SDL_MUSTLOCK(surf)); // fails here, because SDL_MUSTLOCK(surf) should be true, but isn't.
SDL_SetSurfaceRLE (and therefore its callers SDL_SetColorKey+SDL_ConvertSurface) call SDL_RLESurface(surface)? This would set up the surface->flags correctly.
I added a bug report here: https://bugzilla.libsdl.org/show_bug.cgi?id=5304