The code is using `controls.window` before checking if it isn't null.
I found this bug by accident when I tried to run `SDL_ShowSimpleMessageBox`.
It first tried using Wayland with `zenity`, but since I don't have `zenity`, it fallbacked to `X11_ShowMessageBoxImpl`.
For some reason it couldn't create a window, maybe something related to XWayland, so `controls.window` was `NULL`.
[N-Gage] Correct SDL_FLIP_HORIZONTAL for sprite sheet textures
- ApplyFlip: swap toward midpoint when dest == source to avoid
overwriting pixels before they are read
- CopyEx: restore original bitmap pixels after BitBlt so the texture
is not permanently mutated across frames
- CopyEx: extract srcrect sub-region before transforming so flip/
rotate/scale operate on the correct pixels, not the full texture
[N-Gage] Use scratch bitmap in CopyEx to avoid mutating source texture.
Replace the write-then-restore pattern on the source texture with a
persistent iScratchBitmap. The transform pipeline operates entirely
within iPixelBufferA/B; the final result is copied into iScratchBitmap
and BitBlt reads from there. The source texture is never written to.
[N-Gage] Fix Copy() for render-target textures by using direct BitBlt
Bypass pixel readback for SDL_TEXTUREACCESS_TARGET textures in CRenderer::Copy().
Reading raw pixels via DataAddress() on a server-side bitmap is unreliable; use
BitBlt directly instead.
[N-Gage] Implement color-key masking using Symbian's BitBltMasked.
This implementation works fine, but relies on a platform specific property. This isn't ideal.
Todo: Add SDL_PIXELFORMAT_ARGB4444 to the N-Gage's rendering back-end.
[N-Gage] Avoid using BitBltMasked to improve performance. Much better!
Write only non-color-key source pixels directly into the destination bitmap
preserving existing destination pixels wherever the color key matches.
This replaces BitBltMasked and avoids the cost of building an EGray2 mask.
[N-Gage] Remove redundant function call since we're not using BitBltMasked() anymore.
[N-Gage] Remove SDL_PROP_TEXTURE_NGAGE_COLOR_KEY_NUMBER
- Promote SDL_PIXELFORMAT_XRGB4444 to SDL_PIXELFORMAT_ARGB4444 instead.
- Remove now unused functions.
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