summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/render/texture/gltexture.cpp4
-rw-r--r--src/render/texture/gltexture_p.h7
2 files changed, 10 insertions, 1 deletions
diff --git a/src/render/texture/gltexture.cpp b/src/render/texture/gltexture.cpp
index 1a76617a7..0e3291fb0 100644
--- a/src/render/texture/gltexture.cpp
+++ b/src/render/texture/gltexture.cpp
@@ -97,6 +97,7 @@ void GLTexture::destroyGLTexture()
{
delete m_gl;
m_gl = nullptr;
+ QMutexLocker locker(&m_dirtyFlagMutex);
m_dirty = 0;
destroyResources();
@@ -104,6 +105,7 @@ void GLTexture::destroyGLTexture()
QOpenGLTexture* GLTexture::getOrCreateGLTexture()
{
+ QMutexLocker locker(&m_dirtyFlagMutex);
bool needUpload = false;
bool texturedDataInvalid = false;
@@ -210,6 +212,7 @@ void GLTexture::setParameters(const TextureParameters &params)
{
if (m_parameters != params) {
m_parameters = params;
+ QMutexLocker locker(&m_dirtyFlagMutex);
m_dirty |= Parameters;
}
}
@@ -218,6 +221,7 @@ void GLTexture::setProperties(const TextureProperties &props)
{
if (m_properties != props) {
m_properties = props;
+ QMutexLocker locker(&m_dirtyFlagMutex);
m_dirty |= Properties;
}
}
diff --git a/src/render/texture/gltexture_p.h b/src/render/texture/gltexture_p.h
index 7c6bf9c90..424e77854 100644
--- a/src/render/texture/gltexture_p.h
+++ b/src/render/texture/gltexture_p.h
@@ -142,7 +142,11 @@ public:
// Called by TextureDataManager when it has new texture data from
// a generator that needs to be uploaded.
- void requestUpload() { m_dirty |= TextureData; }
+ void requestUpload()
+ {
+ QMutexLocker locker(&m_dirtyFlagMutex);
+ m_dirty |= TextureData;
+ }
protected:
@@ -178,6 +182,7 @@ private:
bool m_unique;
DirtyFlags m_dirty;
+ QMutex m_dirtyFlagMutex;
QOpenGLTexture *m_gl;
TextureDataManager *m_textureDataManager;