diff options
Diffstat (limited to 'src/declarative/qml')
-rw-r--r-- | src/declarative/qml/qmlcontext.cpp | 16 | ||||
-rw-r--r-- | src/declarative/qml/qmlcontext_p.h | 4 | ||||
-rw-r--r-- | src/declarative/qml/qmlexpression.cpp | 25 | ||||
-rw-r--r-- | src/declarative/qml/qmlexpression_p.h | 4 |
4 files changed, 35 insertions, 14 deletions
diff --git a/src/declarative/qml/qmlcontext.cpp b/src/declarative/qml/qmlcontext.cpp index 365ad6d..8a2732d 100644 --- a/src/declarative/qml/qmlcontext.cpp +++ b/src/declarative/qml/qmlcontext.cpp @@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE QmlContextPrivate::QmlContextPrivate() : parent(0), engine(0), isInternal(false), notifyIndex(-1), - highPriorityCount(0), idValues(0), idValueCount(0) + highPriorityCount(0), expressions(0), idValues(0), idValueCount(0) { } @@ -278,11 +278,15 @@ QmlContext::~QmlContext() (*iter)->d_func()->parent = 0; } - for (QSet<QmlExpression *>::ConstIterator iter = - d->childExpressions.begin(); - iter != d->childExpressions.end(); - ++iter) { - (*iter)->d_func()->ctxt = 0; + QmlExpressionPrivate *expression = d->expressions; + while (expression) { + QmlExpressionPrivate *nextExpression = expression->nextExpression; + + expression->ctxt = 0; + expression->prevExpression = 0; + expression->nextExpression = 0; + + expression = nextExpression; } for (int ii = 0; ii < d->contextObjects.count(); ++ii) { diff --git a/src/declarative/qml/qmlcontext_p.h b/src/declarative/qml/qmlcontext_p.h index 4240c8a..60655ae 100644 --- a/src/declarative/qml/qmlcontext_p.h +++ b/src/declarative/qml/qmlcontext_p.h @@ -67,6 +67,7 @@ class QmlContext; class QmlExpression; class QmlEngine; class QmlExpression; +class QmlExpressionPrivate; class QmlContextPrivate : public QObjectPrivate { @@ -102,7 +103,8 @@ public: void invalidateEngines(); QSet<QmlContext *> childContexts; - QSet<QmlExpression *> childExpressions; + + QmlExpressionPrivate *expressions; QmlSimpleDeclarativeData contextData; QObjectList contextObjects; diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qmlexpression.cpp index 148ff71..3206734 100644 --- a/src/declarative/qml/qmlexpression.cpp +++ b/src/declarative/qml/qmlexpression.cpp @@ -51,7 +51,7 @@ Q_DECLARE_METATYPE(QList<QObject *>); QT_BEGIN_NAMESPACE QmlExpressionPrivate::QmlExpressionPrivate() -: ctxt(0), expressionFunctionValid(false), expressionRewritten(false), sseData(0), me(0), trackChange(true), line(-1), guardList(0), guardListLength(0) +: nextExpression(0), prevExpression(0), ctxt(0), expressionFunctionValid(false), expressionRewritten(false), sseData(0), me(0), trackChange(true), line(-1), guardList(0), guardListLength(0) { } @@ -63,8 +63,12 @@ void QmlExpressionPrivate::init(QmlContext *ctxt, const QString &expr, expression = expr; this->ctxt = ctxt; - if (ctxt) - ctxt->d_func()->childExpressions.insert(q); + if (ctxt) { + QmlContextPrivate *cp = ctxt->d_func(); + nextExpression = cp->expressions; + prevExpression = &cp->expressions; + cp->expressions = this; + } this->me = me; } @@ -84,8 +88,12 @@ void QmlExpressionPrivate::init(QmlContext *ctxt, void *expr, QmlRefCount *rc, } this->ctxt = ctxt; - if (ctxt) - ctxt->d_func()->childExpressions.insert(q); + if (ctxt) { + QmlContextPrivate *cp = ctxt->d_func(); + nextExpression = cp->expressions; + prevExpression = &cp->expressions; + cp->expressions = this; + } this->me = me; } @@ -152,8 +160,11 @@ QmlExpression::QmlExpression(QmlContext *ctxt, const QString &expression, QmlExpression::~QmlExpression() { Q_D(QmlExpression); - if (d->ctxt) - d->ctxt->d_func()->childExpressions.remove(this); + if (d->prevExpression) { + *(d->prevExpression) = d->nextExpression; + if (d->nextExpression) + d->nextExpression->prevExpression = d->prevExpression; + } } /*! diff --git a/src/declarative/qml/qmlexpression_p.h b/src/declarative/qml/qmlexpression_p.h index 5ecc24d..f607898 100644 --- a/src/declarative/qml/qmlexpression_p.h +++ b/src/declarative/qml/qmlexpression_p.h @@ -70,6 +70,10 @@ public: QmlExpressionPrivate(); ~QmlExpressionPrivate(); + // Forms the QmlContext "expressions" linked list + QmlExpressionPrivate *nextExpression; + QmlExpressionPrivate **prevExpression; + enum CompiledDataType { BasicScriptEngineData = 1, PreTransformedQtScriptData = 2 |