From ce9d252ce51134bc8ce985445ab6fd107f76dcbd Mon Sep 17 00:00:00 2001 From: Matt Date: Wed, 27 Feb 2019 10:44:02 +0100 Subject: [PATCH] Use correct lock. --- src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp | 6 +++--- src/openrct2-ui/drawing/engines/opengl/TextureCache.h | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp b/src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp index 8272b1a4ba..3c9eb8d86c 100644 --- a/src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp @@ -30,7 +30,7 @@ TextureCache::~TextureCache() void TextureCache::InvalidateImage(uint32_t image) { - std::unique_lock lock(_mutex); + unique_lock lock(_mutex); uint32_t index = _indexMap[image]; if (index == UNUSED_INDEX) @@ -83,7 +83,7 @@ BasicTextureInfo TextureCache::GetOrLoadImageTexture(uint32_t image) } // Load new texture. - std::unique_lock lock(_mutex); + unique_lock lock(_mutex); index = (uint32_t)_textureCache.size(); @@ -118,7 +118,7 @@ BasicTextureInfo TextureCache::GetOrLoadGlyphTexture(uint32_t image, uint8_t* pa } // Load new texture. - std::unique_lock lock(_mutex); + unique_lock lock(_mutex); auto cacheInfo = LoadGlyphTexture(image, palette); auto it = _glyphTextureMap.insert(std::make_pair(glyphId, cacheInfo)); diff --git a/src/openrct2-ui/drawing/engines/opengl/TextureCache.h b/src/openrct2-ui/drawing/engines/opengl/TextureCache.h index c9cebd2e73..c8fc9d584c 100644 --- a/src/openrct2-ui/drawing/engines/opengl/TextureCache.h +++ b/src/openrct2-ui/drawing/engines/opengl/TextureCache.h @@ -206,9 +206,11 @@ private: #ifndef __MACOSX__ std::shared_mutex _mutex; typedef std::shared_lock shared_lock; + typedef std::unique_lock unique_lock; #else std::mutex _mutex; typedef std::unique_lock shared_lock; + typedef std::unique_lock unique_lock; #endif public: