diff options
author | Max Horn | 2003-07-05 15:28:28 +0000 |
---|---|---|
committer | Max Horn | 2003-07-05 15:28:28 +0000 |
commit | ce9d154957d8843a07a32730e7fd3400948e164d (patch) | |
tree | 9d87bf17713d1e064e4d187ab93272e66c5ec91b /common/util.cpp | |
parent | 8a7d540687abdc9a4d431612318bbe43ea0424c8 (diff) | |
download | scummvm-rg350-ce9d154957d8843a07a32730e7fd3400948e164d.tar.gz scummvm-rg350-ce9d154957d8843a07a32730e7fd3400948e164d.tar.bz2 scummvm-rg350-ce9d154957d8843a07a32730e7fd3400948e164d.zip |
fixed stack lock at startup
svn-id: r8779
Diffstat (limited to 'common/util.cpp')
-rw-r--r-- | common/util.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/common/util.cpp b/common/util.cpp index 548fcb6a41..8920453bd7 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -166,7 +166,10 @@ uint RandomSource::getRandomNumberRng(uint min, uint max) { return getRandomNumber(max - min) + min; } -StackLock::StackLock(OSystem::MutexRef mutex) : _mutex(mutex) { +StackLock::StackLock(OSystem::MutexRef mutex, OSystem *syst) + : _mutex(mutex), _syst(syst) { + if (syst == 0) + _syst = g_system; lock(); } @@ -175,12 +178,12 @@ StackLock::~StackLock() { } void StackLock::lock() { - assert(g_system); + assert(_syst); g_system->lock_mutex(_mutex); } void StackLock::unlock() { - assert(g_system); + assert(_syst); g_system->unlock_mutex(_mutex); } |