aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-02-05 12:29:44 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-05 19:48:26 +0100
commitedcdec4b5d23a04e727134723875ae40e0af6d1e (patch)
tree642ec85359b82d2c9c7f5345fe1b42dd14ea6b4d /src/qml
parent37019a96db01b99a76b67b9e655bc457e8edb5a1 (diff)
[new compiler] Fix crash in qml delegate model
qmlContext(this) is expected in re-implementations of classBegin(), so just like the VME we have to be careful that we call it after setting the context on the ddata. Change-Id: I38ad8d1a4e4093368f62f9d57718de3b8cd0cfd2 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index 933242ba72..02c922f2fb 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -902,6 +902,7 @@ QObject *QmlObjectCreator::createInstance(int index, QObject *parent)
bool isComponent = false;
QObject *instance = 0;
QQmlCustomParser *customParser = 0;
+ QQmlParserStatus *parserStatus = 0;
if (compiledData->isComponent(index)) {
isComponent = true;
@@ -922,12 +923,8 @@ QObject *QmlObjectCreator::createInstance(int index, QObject *parent)
}
const int parserStatusCast = type->parserStatusCast();
- if (parserStatusCast != -1) {
- QQmlParserStatus *parserStatus = reinterpret_cast<QQmlParserStatus*>(reinterpret_cast<char *>(instance) + parserStatusCast);
- parserStatus->classBegin();
- _parserStatusCallbacks[index] = parserStatus;
- parserStatus->d = &_parserStatusCallbacks[index];
- }
+ if (parserStatusCast != -1)
+ parserStatus = reinterpret_cast<QQmlParserStatus*>(reinterpret_cast<char *>(instance) + parserStatusCast);
customParser = type->customParser();
@@ -977,6 +974,12 @@ QObject *QmlObjectCreator::createInstance(int index, QObject *parent)
ddata->outerContext = context;
+ if (parserStatus) {
+ parserStatus->classBegin();
+ _parserStatusCallbacks[index] = parserStatus;
+ parserStatus->d = &_parserStatusCallbacks[index];
+ }
+
QHash<int, int>::ConstIterator idEntry = objectIndexToId.find(index);
if (idEntry != objectIndexToId.constEnd())
context->setIdProperty(idEntry.value(), instance);