diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/updatewindow.cpp | 4 | ||||
-rw-r--r-- | src/utils/mutex.h | 13 |
2 files changed, 10 insertions, 7 deletions
diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp index 9d9f5616..1097f072 100644 --- a/src/gui/updatewindow.cpp +++ b/src/gui/updatewindow.cpp @@ -163,7 +163,7 @@ void UpdaterWindow::setProgress(float p) void UpdaterWindow::setLabel(const std::string &str) { // Do delayed label text update, since Guichan isn't thread-safe - MutexLocker lock(mLabelMutex); + MutexLocker lock(&mLabelMutex); mNewLabelCaption = str; } @@ -423,7 +423,7 @@ void UpdaterWindow::logic() // Synchronize label caption when necessary { - MutexLocker lock(mLabelMutex); + MutexLocker lock(&mLabelMutex); if (mLabel->getCaption() != mNewLabelCaption) { diff --git a/src/utils/mutex.h b/src/utils/mutex.h index 6c35987c..62c6b4e1 100644 --- a/src/utils/mutex.h +++ b/src/utils/mutex.h @@ -40,6 +40,9 @@ public: void unlock(); private: + Mutex(const Mutex&); // prevent copying + Mutex& operator=(const Mutex&); + SDL_mutex *mMutex; }; @@ -49,11 +52,11 @@ private: class MutexLocker { public: - MutexLocker(Mutex mutex); + MutexLocker(Mutex *mutex); ~MutexLocker(); private: - Mutex mMutex; + Mutex *mMutex; }; @@ -80,15 +83,15 @@ inline void Mutex::unlock() } -inline MutexLocker::MutexLocker(Mutex mutex): +inline MutexLocker::MutexLocker(Mutex *mutex): mMutex(mutex) { - mMutex.lock(); + mMutex->lock(); } inline MutexLocker::~MutexLocker() { - mMutex.unlock(); + mMutex->unlock(); } #endif // TMW_MUTEX_H |