shithub: cstory

Download patch

ref: d80ef38af55097761200020acca5c11281876704
parent: f42a0530b04f9d8cd7204971dfd9b2d3a8183de3
author: Clownacy <Clownacy@users.noreply.github.com>
date: Thu Sep 10 12:02:13 EDT 2020

Lock SDL2 software renderer surface properly

--- a/src/Backends/Rendering/Window/Software/SDL2.cpp
+++ b/src/Backends/Rendering/Window/Software/SDL2.cpp
@@ -66,6 +66,9 @@
 
 unsigned char* WindowBackend_Software_LockFramebuffer(size_t *pitch)
 {
+	if (SDL_LockSurface(framebuffer_sdlsurface) < 0)
+		return NULL;
+
 	*pitch = framebuffer_sdlsurface->pitch;
 
 	return (unsigned char*)framebuffer_sdlsurface->pixels;
@@ -73,7 +76,7 @@
 
 void WindowBackend_Software_UnlockFramebuffer(void)
 {
-	// Nothing to do here
+	SDL_UnlockSurface(framebuffer_sdlsurface);
 }
 
 void WindowBackend_Software_Display(void)