From 7844a2ed72d0c1788d303c31f04fcccb6e9b0d38 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Fri, 20 Dec 2019 04:33:05 +1100 Subject: [PATCH] fixed race condition in appending to a list of exported cache references --- app/render/backend/opengl/opengltexturecache.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/render/backend/opengl/opengltexturecache.cpp b/app/render/backend/opengl/opengltexturecache.cpp index c5d20c044..30919db98 100644 --- a/app/render/backend/opengl/opengltexturecache.cpp +++ b/app/render/backend/opengl/opengltexturecache.cpp @@ -26,8 +26,6 @@ OpenGLTextureCache::ReferencePtr OpenGLTextureCache::Get(QOpenGLContext* ctx, co } } - lock_.unlock(); - // If we didn't find a texture, we'll need to create one if (!texture) { texture = std::make_shared(); @@ -38,6 +36,9 @@ OpenGLTextureCache::ReferencePtr OpenGLTextureCache::Get(QOpenGLContext* ctx, co ReferencePtr ref = std::make_shared(this, texture); existing_references_.append(ref.get()); + + lock_.unlock(); + return ref; }