sdl12-compat: video: Don't create a new VideoRendererLock if we already have one.

From b2f7b7736b4adaba2805e5d2979c51676ee950ce Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Fri, 13 Jan 2023 15:19:39 -0500
Subject: [PATCH] video: Don't create a new VideoRendererLock if we already
 have one.

Fixes #285.
---
 src/SDL12_compat.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index 7629c2913..b9aa2eabe 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -6143,10 +6143,14 @@ SetVideoModeImpl(int width, int height, int bpp, Uint32 flags12)
         const SDL_bool want_vsync = (vsync_env && SDL20_atoi(vsync_env)) ? SDL_TRUE : SDL_FALSE;
         SDL_RendererInfo rinfo;
         SDL_assert(!VideoGLContext20);  /* either a new window or we destroyed all this */
-        VideoRendererLock = SDL20_CreateMutex();
+
         if (!VideoRendererLock) {
-            return EndVidModeCreate();
+            VideoRendererLock = SDL20_CreateMutex();
+            if (!VideoRendererLock) {
+                return EndVidModeCreate();
+            }
         }
+
         if (!VideoRenderer20 && want_vsync) {
             VideoRenderer20 = SDL20_CreateRenderer(VideoWindow20, -1, SDL_RENDERER_ACCELERATED|SDL_RENDERER_PRESENTVSYNC);
         }