[Scummvm-git-logs] scummvm branch-2-9 -> a3a03764656fbefb6ab31f883a55403b6c0dbd11

mikrosk noreply at scummvm.org
Wed May 7 15:44:34 UTC 2025


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
a3a0376465 BACKENDS: ATARI: Fix a crash


Commit: a3a03764656fbefb6ab31f883a55403b6c0dbd11
    https://github.com/scummvm/scummvm/commit/a3a03764656fbefb6ab31f883a55403b6c0dbd11
Author: Miro Kropacek (miro.kropacek at gmail.com)
Date: 2025-05-07T17:44:29+02:00

Commit Message:
BACKENDS: ATARI: Fix a crash

If error() was called in (Atari)GraphicsManager's c-tor, its d-tor
wouldn't be called, leaving the VBL handler uninitialised.

Changed paths:
    backends/graphics/atari/atari-graphics.cpp
    graphics/blit/blit-atari.cpp


diff --git a/backends/graphics/atari/atari-graphics.cpp b/backends/graphics/atari/atari-graphics.cpp
index ce26eda3d23..77f4e462d26 100644
--- a/backends/graphics/atari/atari-graphics.cpp
+++ b/backends/graphics/atari/atari-graphics.cpp
@@ -291,10 +291,6 @@ AtariGraphicsManager::AtariGraphicsManager()
 	}
 	s_oldPhysbase = Physbase();
 
-	if (!Supexec(InstallVblHandler)) {
-		error("VBL handler was not installed");
-	}
-
 	g_system->getEventManager()->getEventDispatcher()->registerObserver(this, 10, false);
 }
 
@@ -406,6 +402,19 @@ void AtariGraphicsManager::beginGFXTransaction() {
 OSystem::TransactionError AtariGraphicsManager::endGFXTransaction() {
 	atari_debug("endGFXTransaction");
 
+	{
+		// this can't be done in the c-tor because if the c-tor called error(),
+		// its d-tor wouldn't be called => the vbl handler wouldn't be uninstalled
+		// (for the same reason we don't do any resolution changes in the c-tor)
+		static bool vblHandlerInstalled;
+		if (!vblHandlerInstalled) {
+			if (!Supexec(InstallVblHandler)) {
+				error("VBL handler was not installed");
+			}
+			vblHandlerInstalled = true;
+		}
+	}
+
 	_pendingState.inTransaction = false;
 	_ignoreCursorChanges = false;
 
diff --git a/graphics/blit/blit-atari.cpp b/graphics/blit/blit-atari.cpp
index cf8257c5aa7..67ba3371b9e 100644
--- a/graphics/blit/blit-atari.cpp
+++ b/graphics/blit/blit-atari.cpp
@@ -122,8 +122,8 @@ void Surface::create(int16 width, int16 height, const PixelFormat &f) {
 
 			if (!pixels)
 				error("Not enough memory to allocate a surface");
-			else if (pixels <= (void *)0xA0000000)
-				warning("SuperVidel surface allocated in regular memory");
+
+			assert(pixels >= (void *)0xA0000000);
 		} else {
 #else
 		{
@@ -131,8 +131,8 @@ void Surface::create(int16 width, int16 height, const PixelFormat &f) {
 			pixels = ::calloc(height * pitch, f.bytesPerPixel);
 			if (!pixels)
 				error("Not enough memory to allocate a surface");
-			else
-				assert(((uintptr)pixels & (ALIGN - 1)) == 0);
+
+			assert(((uintptr)pixels & (ALIGN - 1)) == 0);
 		}
 	}
 }




More information about the Scummvm-git-logs mailing list