diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2014-02-06 09:35:28 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-07 12:44:08 +0100 |
commit | 50ce88a53107f97664d928719c1877b8077e9a2e (patch) | |
tree | a43fdc574cf5028517443514b5d56be221b86dd1 /src/qml/qml/qqmlobjectcreator_p.h | |
parent | d5a96399cec189251d8ee3e82493aceec112fbd8 (diff) |
[new compiler] Fix parser status and created bindings allocation
Pre-calculate the amount of space we need for binding and parser status
callbacks at compile time and therefore use a much simpler data structure
(vector) to store the points to the bindings and callbacks. They need to be
stored because during object construction and binding enabling phase, it may
happen that they get destroyed and thus their m_mePtr pointing into the array
gets deleted.
The contiguous vector will also make it possible to interrupt the completion
phase.
Change-Id: Ic7c985bb8325ab355112e30e9d33d6ae4e7476d1
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlobjectcreator_p.h')
-rw-r--r-- | src/qml/qml/qqmlobjectcreator_p.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/qml/qml/qqmlobjectcreator_p.h b/src/qml/qml/qqmlobjectcreator_p.h index e5fe4e3b81..cb23f61c84 100644 --- a/src/qml/qml/qqmlobjectcreator_p.h +++ b/src/qml/qml/qqmlobjectcreator_p.h @@ -46,7 +46,7 @@ #include <private/qv4compileddata_p.h> #include <private/qqmlcompiler_p.h> #include <private/qqmltypecompiler_p.h> -#include <QLinkedList> +#include <private/qfinitestack_p.h> QT_BEGIN_NAMESPACE @@ -57,7 +57,9 @@ class QmlObjectCreator { Q_DECLARE_TR_FUNCTIONS(QmlObjectCreator) public: - QmlObjectCreator(QQmlContextData *contextData, QQmlCompiledData *compiledData, QQmlContextData *creationContext, QQmlContextData *rootContext = 0); + QmlObjectCreator(QQmlContextData *contextData, QQmlCompiledData *compiledData, QQmlContextData *creationContext, QQmlContextData *rootContext = 0, + QFiniteStack<QQmlAbstractBinding*> *inheritedBindingStack = 0, QFiniteStack<QQmlParserStatus*> *inheritedParserStatusStack = 0); + ~QmlObjectCreator(); QObject *create(int subComponentIndex = -1, QObject *parent = 0); QQmlContextData *finalize(); @@ -73,7 +75,7 @@ private: bool populateInstance(int index, QObject *instance, QQmlRefPointer<QQmlPropertyCache> cache, QObject *bindingTarget, QQmlPropertyData *valueTypeProperty); void setupBindings(); - bool setPropertyValue(QQmlPropertyData *property, int index, const QV4::CompiledData::Binding *binding); + bool setPropertyBinding(QQmlPropertyData *property, const QV4::CompiledData::Binding *binding); void setPropertyValue(QQmlPropertyData *property, const QV4::CompiledData::Binding *binding); void setupFunctions(); @@ -91,8 +93,9 @@ private: const QVector<QQmlPropertyCache *> propertyCaches; const QVector<QByteArray> vmeMetaObjectData; QHash<int, int> objectIndexToId; - QLinkedList<QVector<QQmlAbstractBinding*> > allCreatedBindings; - QLinkedList<QVector<QQmlParserStatus*> > allParserStatusCallbacks; + QFiniteStack<QQmlAbstractBinding*> *allCreatedBindings; + QFiniteStack<QQmlParserStatus*> *allParserStatusCallbacks; + bool ownBindingAndParserStatusStacks; QQmlCompiledData *compiledData; QQmlContextData *rootContext; @@ -105,10 +108,8 @@ private: QQmlData *_ddata; QQmlRefPointer<QQmlPropertyCache> _propertyCache; QQmlVMEMetaObject *_vmeMetaObject; - QVector<QQmlAbstractBinding*> _createdBindings; QQmlListProperty<void> _currentList; QV4::ExecutionContext *_qmlContext; - QVector<QQmlParserStatus*> _parserStatusCallbacks; }; QT_END_NAMESPACE |