SHA256
1
0
forked from pool/gzdoom
gzdoom/gzdoom-sdlbug.patch

36 lines
1.4 KiB
Diff

From: Jan Engelhardt <jengelh@inai.de>
Date: 2020-06-12 02:05:34.009865606 +0200
When a SDL_PollEvent is sandwiched between SDL_CreateWindow and
SDL_CreateRenderer, SDL crashes during SDL_IME_PumpEvents because dbus message
still references the old window (still exists and pointer is non-NULL) and
tries to access members of window->driverdata (block was freed and pointer is
NULL.)
Workaround this by recreating the SDL_Window object and immediately afterwards
creating the renderer.
This crash only happens for gzdoom when running with the SoftPoly rasterizer,
as that is the only place that issues SDL_CreateRenderer after the mainloop has
started.
Needs a bugreport on libsdl.org.
---
src/common/platform/posix/sdl/sdlglvideo.cpp | 2 ++
1 file changed, 2 insertions(+)
Index: gzdoom-g4.4.1/src/common/platform/posix/sdl/sdlglvideo.cpp
===================================================================
--- gzdoom-g4.4.1.orig/src/common/platform/posix/sdl/sdlglvideo.cpp
+++ gzdoom-g4.4.1/src/common/platform/posix/sdl/sdlglvideo.cpp
@@ -294,6 +294,8 @@ uint8_t *I_PolyPresentLock(int w, int h,
{
polyvsync = vsync;
+ Priv::DestroyWindow();
+ Priv::CreateWindow(Priv::VulkanWindowFlag | (Priv::softpolyEnabled ? SDL_WINDOW_HIDDEN : 0));
polyrendertarget = SDL_CreateRenderer(Priv::window, -1, vsync ? SDL_RENDERER_PRESENTVSYNC : 0);
if (!polyrendertarget)
{