From 6b67a538336112671c3512509c7a0c9031732e37 Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Thu, 20 Feb 2020 09:55:41 +0100 Subject: Inline components: do not leak context Change-Id: Ic738f3ea8f91cf2ffc7fb86ad9f72c0d630b6de8 Reviewed-by: Ulf Hermann --- src/qml/qml/qqmlobjectcreator.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index 28dd3d4ab4..aff982012d 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -1264,7 +1264,10 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo ddata->columnNumber = obj->location.column; ddata->setImplicitDestructible(); - if (static_cast(index) == /*root object*/0 || ddata->rootObjectInCreation) { + // inline components are root objects, but their index is != 0, so we need + // an additional check + const bool isInlineComponent = obj->flags & QV4::CompiledData::Object::IsInlineComponentRoot; + if (static_cast(index) == /*root object*/0 || ddata->rootObjectInCreation || isInlineComponent) { if (ddata->context) { Q_ASSERT(ddata->context != context); Q_ASSERT(ddata->outerContext); -- cgit v1.2.3