diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2016-06-03 11:22:35 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2016-06-03 13:24:04 +0000 |
commit | 23ec4ac8ba5450b79dbef857f0062bfb068e98d3 (patch) | |
tree | 741e18a1bb4617c92a62f2643057b0445b0858fc /src | |
parent | a8399c5440ef35f8feebcd086b5e46ce0000eea5 (diff) |
Minor refcounting cleaning
Replace manual reference counting with automated counting, which is
less error prone.
Change-Id: I6a133bf9610f0d789f745b3cc1f0016e670a9525
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/qml/qqmlcontext.cpp | 5 | ||||
-rw-r--r-- | src/qml/qml/qqmlcontext_p.h | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmlobjectcreator.cpp | 1 | ||||
-rw-r--r-- | src/qml/qml/qqmltypeloader.cpp | 4 |
4 files changed, 2 insertions, 10 deletions
diff --git a/src/qml/qml/qqmlcontext.cpp b/src/qml/qml/qqmlcontext.cpp index b3081ddbe6..6621f48e20 100644 --- a/src/qml/qml/qqmlcontext.cpp +++ b/src/qml/qml/qqmlcontext.cpp @@ -524,7 +524,7 @@ QQmlContextData::QQmlContextData(QQmlContext *ctxt) : parent(0), engine(0), isInternal(false), ownedByParent(false), isJSContext(false), isPragmaLibraryContext(false), unresolvedNames(false), hasEmittedDestruction(false), isRootObjectInCreation(false), publicContext(ctxt), activeVMEData(0), componentObjectIndex(-1), - contextObject(0), imports(0), childContexts(0), nextChild(0), prevChild(0), + contextObject(0), childContexts(0), nextChild(0), prevChild(0), expressions(0), contextObjects(0), contextGuards(0), idValues(0), idValueCount(0), linkedContext(0), componentAttached(0) { @@ -628,9 +628,6 @@ void QQmlContextData::destroy() } contextGuards = 0; - if (imports) - imports->release(); - delete [] idValues; if (isInternal) diff --git a/src/qml/qml/qqmlcontext_p.h b/src/qml/qml/qqmlcontext_p.h index 05ce39401e..62cd3d4877 100644 --- a/src/qml/qml/qqmlcontext_p.h +++ b/src/qml/qml/qqmlcontext_p.h @@ -174,7 +174,7 @@ public: QString urlString() const; // List of imports that apply to this context - QQmlTypeNameCache *imports; + QQmlRefPointer<QQmlTypeNameCache> imports; // My children QQmlContextData *childContexts; diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index 80e0fa3595..9e2040469b 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -167,7 +167,6 @@ QObject *QQmlObjectCreator::create(int subComponentIndex, QObject *parent, QQmlI context = new QQmlContextData; context->isInternal = true; context->imports = compilationUnit->importCache; - context->imports->addref(); context->initFromTypeCompilationUnit(compilationUnit, subComponentIndex); context->setParent(parentContext); diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index b2f4c6749d..87036d9ea4 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -2552,10 +2552,6 @@ QV4::ReturnedValue QQmlScriptData::scriptValueForContext(QQmlContextData *parent ctxt->importedScripts = effectiveCtxt->importedScripts; } - if (ctxt->imports) { - ctxt->imports->addref(); - } - if (effectiveCtxt) { ctxt->setParent(effectiveCtxt, true); } else { |