From bc8a90b33ac421c650e50182e73f2c1125edaaf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20D=C3=BCrrenberger?= Date: Tue, 1 Aug 2017 17:49:14 +0200 Subject: [PATCH] Fix an issue when sf::Clock is constructed in a global scope leading to crashes. --- src/SFML/System/Win32/ClockImpl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SFML/System/Win32/ClockImpl.cpp b/src/SFML/System/Win32/ClockImpl.cpp index 8098a7d4..79acc0c9 100644 --- a/src/SFML/System/Win32/ClockImpl.cpp +++ b/src/SFML/System/Win32/ClockImpl.cpp @@ -33,8 +33,6 @@ namespace { - sf::Mutex oldWindowsMutex; - LARGE_INTEGER getFrequency() { LARGE_INTEGER frequency; @@ -67,6 +65,8 @@ Time ClockImpl::getCurrentTime() if (oldWindows) { + static sf::Mutex oldWindowsMutex; + // Acquire a lock (CRITICAL_SECTION) to prevent travelling back in time Lock lock(oldWindowsMutex);