diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-02-12 04:57:09 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-02-12 04:58:22 (GMT) |
commit | 5cdeb08485f3ed49efc3d0b918254e78ad00c84b (patch) | |
tree | 8733ae2ebdc27d0b67b3127c3703e7c8c76ce07e /src | |
parent | 1d2b1b31166e029e009f08877ef95f95e58a03a4 (diff) | |
download | Qt-5cdeb08485f3ed49efc3d0b918254e78ad00c84b.zip Qt-5cdeb08485f3ed49efc3d0b918254e78ad00c84b.tar.gz Qt-5cdeb08485f3ed49efc3d0b918254e78ad00c84b.tar.bz2 |
Reference count shared expression data
QmlExpression uses data from the QmlCompiledComponent (eg. expression
string data). It must therefore hold a reference to the
QmlCompiledComponent to prevent the data being deleted.
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/qml/qmlexpression.cpp | 7 | ||||
-rw-r--r-- | src/declarative/qml/qmlexpression_p.h | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qmlexpression.cpp index ff1705b..6f32ef4 100644 --- a/src/declarative/qml/qmlexpression.cpp +++ b/src/declarative/qml/qmlexpression.cpp @@ -71,7 +71,7 @@ bool QmlDelayedError::addError(QmlEnginePrivate *e) } QmlExpressionData::QmlExpressionData() -: expressionFunctionValid(false), expressionRewritten(false), me(0), +: q(0), dataRef(0), expressionFunctionValid(false), expressionRewritten(false), me(0), trackChange(true), isShared(false), line(-1), guardList(0), guardListLength(0) { } @@ -79,6 +79,7 @@ QmlExpressionData::QmlExpressionData() QmlExpressionData::~QmlExpressionData() { if (guardList) { delete [] guardList; guardList = 0; } + if (dataRef) dataRef->release(); } QmlExpressionPrivate::QmlExpressionPrivate() @@ -113,6 +114,10 @@ void QmlExpressionPrivate::init(QmlContext *ctxt, void *expr, QmlRefCount *rc, data->url = url; data->line = lineNumber; + if (data->dataRef) data->dataRef->release(); + data->dataRef = rc; + if (data->dataRef) data->dataRef->addref(); + quint32 *exprData = (quint32 *)expr; QmlCompiledData *dd = (QmlCompiledData *)rc; diff --git a/src/declarative/qml/qmlexpression_p.h b/src/declarative/qml/qmlexpression_p.h index 1fbb075..b19c60c 100644 --- a/src/declarative/qml/qmlexpression_p.h +++ b/src/declarative/qml/qmlexpression_p.h @@ -114,6 +114,7 @@ public: QmlExpressionPrivate *q; + QmlRefCount *dataRef; QString expression; bool expressionFunctionValid:1; bool expressionRewritten:1; |