aboutsummaryrefslogtreecommitdiffstats
path: root/src/particles/qquickcustomaffector.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-09-14 11:25:02 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-18 13:14:13 +0200
commitf79df5da0769836bc866b470cdac43d6363dc7db (patch)
tree28deb1584b6c43dca92b39328bcf43099a92fcd6 /src/particles/qquickcustomaffector.cpp
parente4e90923c93adfafb23c81be7359e8df2a500b4f (diff)
Convert more methods to return a Returned<>
Change-Id: If294c9c4f574824c308b63a11da1337226180105 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/particles/qquickcustomaffector.cpp')
-rw-r--r--src/particles/qquickcustomaffector.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/particles/qquickcustomaffector.cpp b/src/particles/qquickcustomaffector.cpp
index 40d0df1a22..09f8967045 100644
--- a/src/particles/qquickcustomaffector.cpp
+++ b/src/particles/qquickcustomaffector.cpp
@@ -146,13 +146,14 @@ void QQuickCustomAffector::affectSystem(qreal dt)
QQmlEngine *qmlEngine = ::qmlEngine(this);
QV4::ExecutionEngine *v4 = QV8Engine::getV4(qmlEngine->handle());
- QV4::ArrayObject *array = v4->newArrayObject(toAffect.size());
+ QV4::Scope scope(v4);
+ QV4::Scoped<QV4::ArrayObject> array(scope, v4->newArrayObject(toAffect.size()));
for (int i=0; i<toAffect.size(); i++)
array->putIndexed(i, toAffect[i]->v4Value().toValue());
if (dt >= simulationCutoff || dt <= simulationDelta) {
affectProperties(toAffect, dt);
- emit affectParticles(QQmlV4Handle(QV4::Value::fromObject(array)), dt);
+ emit affectParticles(QQmlV4Handle(array.asValue()), dt);
} else {
int realTime = m_system->timeInt;
m_system->timeInt -= dt * 1000.0;
@@ -160,12 +161,12 @@ void QQuickCustomAffector::affectSystem(qreal dt)
m_system->timeInt += simulationDelta * 1000.0;
dt -= simulationDelta;
affectProperties(toAffect, simulationDelta);
- emit affectParticles(QQmlV4Handle(QV4::Value::fromObject(array)), simulationDelta);
+ emit affectParticles(QQmlV4Handle(array.asValue()), simulationDelta);
}
m_system->timeInt = realTime;
if (dt > 0.0) {
affectProperties(toAffect, dt);
- emit affectParticles(QQmlV4Handle(QV4::Value::fromObject(array)), dt);
+ emit affectParticles(QQmlV4Handle(array.asValue()), dt);
}
}