Without this lock, a concurrent call to SDL_ReleaseGPUBuffer, SDL_ReleaseGPUTransferBuffer or SDL_ReleaseGPUTexture can cause one of the arrays to be reallocated while METAL_INTERNAL_PerformPendingDestroys is iterating over it, causing a bad day all around.
The AAssetManager won't supply this information to us, but it's just a zip
file, so we can read its central directory ourselves. We can still use
AAssetManager for file i/o to the APK's assets, so we don't have to deal with
compression and other zipfile features.
Fixes#15220.
Reference Issue #15347.
On some platforms, SDL_MemoryBarrierRelease() is defined to
SDL_CompilerBarrier(). If SDL_CompilerBarrier() is also defined to
the fallback spinlock acquire/release, then we will infinitely
recurse in SDL_UnlockSpinlock(). Avoid this by not unlocking the
temporary spinlock we create.
If a size change occurs, the sdl2-compat event handler will flush the renderer, which will cause the software renderer to re-acquire a surface that was invalidated due to the size change. However, if the OnWindowPixelSizeChanged handler is called afterward, the invalid flag will be set on the surface, causing presentation to fail.
Check both for a null surface pointer and an invalid surface flag when checking surface validity in the software renderer.
Previously, if UpdateAudioSession() failed on close--which it might if
something strange has happened with the system's audio configuration--the
listener wouldn't be deregistered, and would risk touching a free'd pointer
if the app moved to or from the background afterwards, firing an event handler
that should have been deregistered.
Closes#15439.
This way you can always safely use SDL_GetError() in your formatted string:
```c
SDL_SetError("Couldn't open '%s': %s", filename, SDL_GetError());
```
This problem was hidden on platforms that use the dynamic API, because it
would format the new error string to a separate buffer first, to deal with
the varargs entry point.
Fixes#15456.
- Add missing SDL_MemoryBarrierRelease() in the generic codepath
- Remove MSVC x86/x64 case which is now identical to the generic codepath
- Fix Solaris barrier to ensure prior stores are visible before unlocking
Only send the unblocking exposure event once per frame, so that clients using an event watcher won't redraw excessively.
Also ensure that the unblocking exposure is always sent on the libdecor path.