From 0d76ec52a53b78844686eeace7c1574232a5c9de Mon Sep 17 00:00:00 2001 From: pjft Date: Tue, 12 Jun 2018 22:20:03 +0100 Subject: [PATCH] Adjust mutex for SVG initialization and resizing --- es-core/src/resources/TextureData.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) 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;