summaryrefslogtreecommitdiffstats
path: root/src/runtime
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@qt.io>2019-06-19 13:57:02 +0300
committerMiikka Heikkinen <miikka.heikkinen@qt.io>2019-06-20 08:31:41 +0300
commitd66674bf53a572c1788ae35649539c3d381de875 (patch)
treed00e5af822ff474dcfe7119b0a084fb31212dcf5 /src/runtime
parentb04e20c05278267a168b07cabfd74a67e33539de (diff)
Fix string type data inputs and setAttribute leaking memory
Two leaks were fixed: 1 - String table now uses separate storage for dynamic strings 2 - Glyph cache is deleted if not used for current frame Task-number: QT3DS-3686 Change-Id: Ib4cf2c61c5301a030039fef51b6d00b06d988c45 Reviewed-by: Jari Karppinen <jari.karppinen@qt.io> Reviewed-by: Antti Määttä <antti.maatta@qt.io> Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/Qt3DSElementSystem.cpp2
-rw-r--r--src/runtime/Qt3DSQmlElementHelper.cpp4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/runtime/Qt3DSElementSystem.cpp b/src/runtime/Qt3DSElementSystem.cpp
index b4d3fbc..f77bac5 100644
--- a/src/runtime/Qt3DSElementSystem.cpp
+++ b/src/runtime/Qt3DSElementSystem.cpp
@@ -673,6 +673,8 @@ void SElement::SetAttribute(TPropertyDescAndValuePtr inKey, const Q3DStudio::UVa
case Q3DStudio::ATTRIBUTETYPE_STRING:
if (currentValue->m_StringHandle == inValue.m_StringHandle)
return;
+ m_BelongedPresentation->GetStringTable().releaseDynamicHandle(
+ currentValue->m_StringHandle);
break;
default: // Early return
if (Q3DStudio::ATTRIBUTE_EYEBALL != attHash && currentValue->m_INT32 == inValue.m_INT32)
diff --git a/src/runtime/Qt3DSQmlElementHelper.cpp b/src/runtime/Qt3DSQmlElementHelper.cpp
index 81649f2..0a13a1f 100644
--- a/src/runtime/Qt3DSQmlElementHelper.cpp
+++ b/src/runtime/Qt3DSQmlElementHelper.cpp
@@ -210,8 +210,8 @@ bool CQmlElementHelper::SetAttribute(TElement *theElement, const char *theAttNam
case ATTRIBUTETYPE_STRING:
theNewValue.m_StringHandle =
- theElement->GetBelongedPresentation()->GetStringTable().GetHandle(
- (const char *)value);
+ theElement->GetBelongedPresentation()->GetStringTable().getDynamicHandle(
+ QByteArray(static_cast<const char *>(value)));
break;
case ATTRIBUTETYPE_POINTER: