From cf317d5db18cfadec0a2a6fab43898e2f0e6f2d1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Sun, 14 May 2023 23:33:41 -0400
Subject: [PATCH] Fix (unlikely) deadlock when load_vmode() fails.

---
 src/conio/x_events.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/conio/x_events.c b/src/conio/x_events.c
index d776adbb08..aacc42b574 100644
--- a/src/conio/x_events.c
+++ b/src/conio/x_events.c
@@ -559,10 +559,12 @@ static int video_init()
 	if (ciolib_initial_scaling != 0.0)
 		x_cvstat.scaling = vstat.scaling = ciolib_initial_scaling;
 	if (x_cvstat.scaling < 1.0 || vstat.scaling < 1.0)
-		x_cvstat.scaling = vstat.scaling = 1;
+		x_cvstat.scaling = vstat.scaling = 1.0;
 	/* Initialize mode 3 (text, 80x25, 16 colors) */
-	if(load_vmode(&vstat, ciolib_initial_mode))
+	if(load_vmode(&vstat, ciolib_initial_mode)) {
+		pthread_mutex_unlock(&vstatlock);
 		return(-1);
+	}
 	x_cvstat = vstat;
 	pthread_mutex_unlock(&vstatlock);
 	if(init_window())
-- 
GitLab