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>
This commit is contained in:
Simon Hausmann 2016-06-03 11:22:35 +02:00
parent a8399c5440
commit 23ec4ac8ba
4 changed files with 2 additions and 10 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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);

View File

@ -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 {