aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmltype.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/qml/qqmltype.cpp')
-rw-r--r--src/qml/qml/qqmltype.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/qml/qml/qqmltype.cpp b/src/qml/qml/qqmltype.cpp
index 2b804c45a7..96a35b0fe9 100644
--- a/src/qml/qml/qqmltype.cpp
+++ b/src/qml/qml/qqmltype.cpp
@@ -946,7 +946,8 @@ int QQmlType::generatePlaceHolderICId() const
void QQmlType::associateInlineComponent(const QString &name, int objectID, const CompositeMetaTypeIds &metaTypeIds, QQmlType existingType)
{
- auto priv = existingType.isValid() ? const_cast<QQmlTypePrivate *>(existingType.d.data()) : new QQmlTypePrivate { RegistrationType::InlineComponentType } ;
+ bool const reuseExistingType = existingType.isValid();
+ auto priv = reuseExistingType ? const_cast<QQmlTypePrivate *>(existingType.d.data()) : new QQmlTypePrivate { RegistrationType::InlineComponentType } ;
priv->setName( QString::fromUtf8(typeName()), name);
auto icUrl = QUrl(sourceUrl());
icUrl.setFragment(QString::number(objectID));
@@ -958,6 +959,8 @@ void QQmlType::associateInlineComponent(const QString &name, int objectID, const
d->namesToInlineComponentObjectIndex.insert(name, objectID);
QQmlType icType(priv);
d->objectIdToICType.insert(objectID, icType);
+ if (!reuseExistingType)
+ priv->release();
}
void QQmlType::setPendingResolutionName(const QString &name)