diff options
Diffstat (limited to 'src/qml/qml/qqmlobjectcreator_p.h')
-rw-r--r-- | src/qml/qml/qqmlobjectcreator_p.h | 46 |
1 files changed, 21 insertions, 25 deletions
diff --git a/src/qml/qml/qqmlobjectcreator_p.h b/src/qml/qml/qqmlobjectcreator_p.h index fb4d71d054..6919281b77 100644 --- a/src/qml/qml/qqmlobjectcreator_p.h +++ b/src/qml/qml/qqmlobjectcreator_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the tools applications of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -50,6 +42,8 @@ #include <private/qrecursionwatcher_p.h> #include <private/qqmlprofiler_p.h> +#include <qpointer.h> + QT_BEGIN_NAMESPACE class QQmlAbstractBinding; @@ -63,7 +57,7 @@ struct QQmlObjectCreatorSharedState : public QSharedData QQmlContextData *creationContext; QFiniteStack<QQmlAbstractBinding*> allCreatedBindings; QFiniteStack<QQmlParserStatus*> allParserStatusCallbacks; - QFiniteStack<QObject*> allCreatedObjects; + QFiniteStack<QPointer<QObject> > allCreatedObjects; QV4::Value *allJavaScriptObjects; // pointer to vector on JS stack to reference JS wrappers during creation phase. QQmlComponentAttached *componentAttached; QList<QQmlEnginePrivate::FinalizeCallback> finalizeCallbacks; @@ -89,8 +83,8 @@ public: QList<QQmlError> errors; - QQmlContextData *parentContextData() const { return parentContext; } - QFiniteStack<QObject*> &allCreatedObjects() const { return sharedState->allCreatedObjects; } + QQmlContextData *parentContextData() { return parentContext.contextData(); } + QFiniteStack<QPointer<QObject> > &allCreatedObjects() const { return sharedState->allCreatedObjects; } private: QQmlObjectCreator(QQmlContextData *contextData, QQmlCompiledData *compiledData, QQmlObjectCreatorSharedState *inheritedSharedState); @@ -108,9 +102,11 @@ private: void setPropertyValue(QQmlPropertyData *property, const QV4::CompiledData::Binding *binding); void setupFunctions(); - QString stringAt(int idx) const { return qmlUnit->header.stringAt(idx); } + QString stringAt(int idx) const { return qmlUnit->stringAt(idx); } void recordError(const QV4::CompiledData::Location &location, const QString &description); + void registerObjectWithContextById(int objectIndex, QObject *instance) const; + enum Phase { Startup, CreatingObjects, @@ -122,8 +118,8 @@ private: QQmlEngine *engine; QQmlCompiledData *compiledData; - const QV4::CompiledData::QmlUnit *qmlUnit; - QQmlContextData *parentContext; + const QV4::CompiledData::Unit *qmlUnit; + QQmlGuardedContextData parentContext; QQmlContextData *context; const QHash<int, QQmlCompiledData::TypeReference*> &resolvedTypes; const QVector<QQmlPropertyCache *> &propertyCaches; |