summaryrefslogtreecommitdiff
path: root/src/quick/scenegraph/util/qsgsimpletexturenode.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/scenegraph/util/qsgsimpletexturenode.cpp')
-rw-r--r--src/quick/scenegraph/util/qsgsimpletexturenode.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/quick/scenegraph/util/qsgsimpletexturenode.cpp b/src/quick/scenegraph/util/qsgsimpletexturenode.cpp
index 8d38e8302..d9f3c4437 100644
--- a/src/quick/scenegraph/util/qsgsimpletexturenode.cpp
+++ b/src/quick/scenegraph/util/qsgsimpletexturenode.cpp
@@ -223,9 +223,11 @@ QRectF QSGSimpleTextureNode::sourceRect() const
void QSGSimpleTextureNode::setTexture(QSGTexture *texture)
{
Q_ASSERT(texture);
+ Q_D(QSGSimpleTextureNode);
+ if (d->ownsTexture)
+ delete m_material.texture();
m_material.setTexture(texture);
m_opaque_material.setTexture(texture);
- Q_D(QSGSimpleTextureNode);
qsgsimpletexturenode_update(&m_geometry, texture, m_rect, d->sourceRect, d->texCoordMode);
DirtyState dirty = DirtyMaterial;