diff --git a/es-core/src/resources/TextureData.cpp b/es-core/src/resources/TextureData.cpp index 17e7cd6f7..f493a91c4 100644 --- a/es-core/src/resources/TextureData.cpp +++ b/es-core/src/resources/TextureData.cpp @@ -35,11 +35,9 @@ void TextureData::initFromPath(const std::string& path) bool TextureData::initSVGFromMemory(const unsigned char* fileData, size_t length) { // If already initialised then don't read again - { - std::unique_lock lock(mMutex); - if (mDataRGBA) - return true; - } + std::unique_lock lock(mMutex); + if (mDataRGBA) + return true; // nsvgParse excepts a modifiable, null-terminated string char* copy = (char*)malloc(length + 1); @@ -84,7 +82,6 @@ bool TextureData::initSVGFromMemory(const unsigned char* fileData, size_t length ImageIO::flipPixelsVert(dataRGBA, mWidth, mHeight); - std::unique_lock lock(mMutex); mDataRGBA = dataRGBA; return true;