summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-04-01 07:17:37 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-04-01 07:17:37 (GMT)
commit739c1c6a4322c0d48afd2a24e3dc2156fee577e1 (patch)
treeb320072393ec386b96a57d68ab49083d2f4baa78 /src/declarative/qml/qdeclarativeobjectscriptclass.cpp
parent8907d7cc427e5f1022c6f25944a123e65391c4f2 (diff)
downloadQt-739c1c6a4322c0d48afd2a24e3dc2156fee577e1.zip
Qt-739c1c6a4322c0d48afd2a24e3dc2156fee577e1.tar.gz
Qt-739c1c6a4322c0d48afd2a24e3dc2156fee577e1.tar.bz2
Optimization: Only allocate QScriptValue if we need too
Diffstat (limited to 'src/declarative/qml/qdeclarativeobjectscriptclass.cpp')
-rw-r--r--src/declarative/qml/qdeclarativeobjectscriptclass.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
index 84c9bef..1424508 100644
--- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
@@ -109,11 +109,11 @@ QScriptValue QDeclarativeObjectScriptClass::newQObject(QObject *object, int type
return scriptEngine->undefinedValue();
} else if (!ddata->indestructible && !object->parent()) {
return newObject(scriptEngine, this, new ObjectData(object, type));
- } else if (!ddata->scriptValue.isValid()) {
- ddata->scriptValue = newObject(scriptEngine, this, new ObjectData(object, type));
- return ddata->scriptValue;
- } else if (ddata->scriptValue.engine() == QDeclarativeEnginePrivate::getScriptEngine(engine)) {
- return ddata->scriptValue;
+ } else if (!ddata->scriptValue) {
+ ddata->scriptValue = new QScriptValue(newObject(scriptEngine, this, new ObjectData(object, type)));
+ return *ddata->scriptValue;
+ } else if (ddata->scriptValue->engine() == QDeclarativeEnginePrivate::getScriptEngine(engine)) {
+ return *ddata->scriptValue;
} else {
return newObject(scriptEngine, this, new ObjectData(object, type));
}