From 0907a833f55becedc09e948c6065f795b943d122 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sun, 21 Feb 2021 00:12:50 +0300
Subject: [PATCH] Quit12Video: clean-up static data by calling
EndVidModeCreate().
fixes segmentation fault upon video quit and re-init reported at
https://github.com/libsdl-org/sdl12-compat/issues/24
---
src/SDL12_compat.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index 9e3588d..dae2c57 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -1365,6 +1365,7 @@ SDL_WasInit(Uint32 sdl12flags)
return InitFlags20to12(SDL20_WasInit(sdl20flags)) | extraflags;
}
+static SDL12_Surface *EndVidModeCreate(void);
static void
Quit12Video(void)
{
@@ -1373,6 +1374,8 @@ Quit12Video(void)
SDL20_FreeSurface(VideoIcon20);
VideoIcon20 = NULL;
+ EndVidModeCreate(); /* clean-up static data. */
+
for (i = 0; i < VideoModesCount; i++) {
SDL20_free(VideoModes[i].modeslist12);
SDL20_free(VideoModes[i].modes12);