aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@jollamobile.com>2014-08-18 09:31:08 +0200
committerGunnar Sletta <gunnar.sletta@jollamobile.com>2014-08-19 09:50:53 +0200
commit29efdf1981a60a796e611f3bc8763afdcb6c2497 (patch)
tree348bca72a3d211909fe3a5b96ae3fce54b1465f3
parent2ae518d3a4ea994dfb6c120f826ef7c801b70807 (diff)
Fix memory corruption in shader materials.
Change ee616b3905106a3eedef9ee964ab283ef45c7dbc accidentally removed the member variable used to refcount the attribute names. This resulted in the names being deleted and the stored const char *'s to become invalid. Add it back. Change-Id: Ie33f75cd76085283a5ee685602e023bb3c42c896 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
-rw-r--r--src/quick/items/qquickshadereffectnode.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/quick/items/qquickshadereffectnode.cpp b/src/quick/items/qquickshadereffectnode.cpp
index df1fceae4c..cefb006648 100644
--- a/src/quick/items/qquickshadereffectnode.cpp
+++ b/src/quick/items/qquickshadereffectnode.cpp
@@ -65,6 +65,7 @@ protected:
virtual const char *fragmentShader() const;
const QQuickShaderEffectMaterialKey m_key;
+ QVector<QByteArray> m_attributes;
QVector<const char *> m_attributeNames;
QString m_log;
bool m_compiled;
@@ -75,11 +76,12 @@ protected:
QQuickCustomMaterialShader::QQuickCustomMaterialShader(const QQuickShaderEffectMaterialKey &key, const QVector<QByteArray> &attributes)
: m_key(key)
+ , m_attributes(attributes)
, m_compiled(false)
, m_initialized(false)
{
- for (int i = 0; i < attributes.count(); ++i)
- m_attributeNames.append(attributes.at(i).constData());
+ for (int i = 0; i < m_attributes.count(); ++i)
+ m_attributeNames.append(m_attributes.at(i).constData());
m_attributeNames.append(0);
}