[Scummvm-git-logs] scummvm master -> 698dbbdfca90fa08df6a0afbb51a8109983a20d7

sev- sev at scummvm.org
Thu Jul 2 16:12:48 UTC 2020


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

Summary:
698dbbdfca BACKENDS: Attempt to address race condition on slow systems with timers


Commit: 698dbbdfca90fa08df6a0afbb51a8109983a20d7
    https://github.com/scummvm/scummvm/commit/698dbbdfca90fa08df6a0afbb51a8109983a20d7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-07-02T18:12:31+02:00

Commit Message:
BACKENDS: Attempt to address race condition on slow systems with timers

Changed paths:
    backends/timer/sdl/sdl-timer.cpp


diff --git a/backends/timer/sdl/sdl-timer.cpp b/backends/timer/sdl/sdl-timer.cpp
index 22d4bb985f..a1e34c8d20 100644
--- a/backends/timer/sdl/sdl-timer.cpp
+++ b/backends/timer/sdl/sdl-timer.cpp
@@ -29,7 +29,12 @@
 
 #include "common/textconsole.h"
 
+static bool timerInstalled = false;
+
 static Uint32 timer_handler(Uint32 interval, void *param) {
+	if (!timerInstalled)
+		return interval;
+
 	((DefaultTimerManager *)param)->handler();
 	return interval;
 }
@@ -40,11 +45,14 @@ SdlTimerManager::SdlTimerManager() {
 		error("Could not initialize SDL: %s", SDL_GetError());
 	}
 
+	timerInstalled = true;
+
 	// Creates the timer callback
 	_timerID = SDL_AddTimer(10, &timer_handler, this);
 }
 
 SdlTimerManager::~SdlTimerManager() {
+	timerInstalled = false;
 	// Removes the timer callback
 	SDL_RemoveTimer(_timerID);
 }




More information about the Scummvm-git-logs mailing list