aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorTobias Koenig <tobias.koenig@kdab.com>2015-07-03 10:55:35 +0200
committerTobias Koenig <tobias.koenig@kdab.com>2015-07-03 17:10:15 +0000
commiteeee9f1466ffaf17f81d635c2e43dca76ce5b021 (patch)
treecb96f082237e9adb4290b428fcc36a8c6f9554a3 /src/quick
parent8b205fd05dcdc4a0e7ec6b25429f691a0a9099fe (diff)
QSGSimpleTextureNode: Fix ownership of QSGTexture
Make sure the QSGSimpleTextureNode deletes the old QSGTexture if a new one is set via setTexture() and the ownsTexture flag is true. [ChangeLog][QtQuick][SceneGraph] QSGSimpleTextureNode will now delete the currently set QSGTexture object, if a new QSGTexture is set and the ownsTexture flag is on. Change-Id: Iabfbccd390e16948d4575baf29e6c8b4a184a404 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src/quick')
-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 8d38e83029..d9f3c44374 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;