diff options
Diffstat (limited to 'src/qml/qml/qqmlobjectcreator.cpp')
-rw-r--r-- | src/qml/qml/qqmlobjectcreator.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index c181d791f5..68e2c2c928 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -1230,13 +1230,15 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo QQmlContextData *c = ddata->context; while (c->linkedContext) c = c->linkedContext; c->linkedContext = context; - } else - context->addObject(instance); + } else { + ddata->context = context; + } ddata->ownContext = ddata->context; - } else if (!ddata->context) - context->addObject(instance); + } else if (!ddata->context) { + ddata->context = context; + } - ddata->outerContext = context; + context->addObject(ddata); if (parserStatus) { parserStatus->classBegin(); |