Protect against QQmlContext deletion during incubation re-using the existing
QQmlContextGuard.
Change-Id: Ia1c0241029765cc2e00a9b0ffcf484127de20606
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
incubatorList.insert(p.data());
incubatorCount++;
- p->vmeGuard.guard(&p->vme);
+ if (useNewCompiler)
+ p->vmeGuard.guard(p->creator.data());
+ else
+ p->vmeGuard.guard(&p->vme);
p->changeStatus(QQmlIncubator::Loading);
if (incubationController)
}
}
} else {
- vmeGuard.guard(&vme);
+ if (enginePriv->useNewCompiler)
+ vmeGuard.guard(creator.data());
+ else
+ vmeGuard.guard(&vme);
}
}
QList<QQmlError> errors;
+ QQmlContextData *parentContextData() const { return parentContext; }
+
private:
QObject *createInstance(int index, QObject *parent = 0);
m_contexts[m_contextCount - 1] = vme->rootContext.contextData();
}
+void QQmlVMEGuard::guard(QmlObjectCreator *creator)
+{
+ clear();
+ m_contextCount = 1;
+ m_contexts = new QQmlGuardedContextData[m_contextCount];
+ m_contexts[0] = creator->parentContextData();
+}
+
void QQmlVMEGuard::clear()
{
delete [] m_objects;
~QQmlVMEGuard();
void guard(QQmlVME *);
+ void guard(QmlObjectCreator *);
void clear();
bool isOK() const;