diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-24 13:53:54 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-26 09:05:22 +0200 |
commit | 0f204625dc6720d40df22ca352af995af5448525 (patch) | |
tree | edb78721935e2b0d34927b3dc358c3b171dc43b1 /src/quick/items/qquickdroparea.cpp | |
parent | a57085f00b146798a0cca0d52dfa127232c3e659 (diff) |
Fix QQmlV4Function API to be GC safe
Change-Id: Id4f79c22fc48ada1c8a9a858e1b7b3d1cf14d120
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/quick/items/qquickdroparea.cpp')
-rw-r--r-- | src/quick/items/qquickdroparea.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/quick/items/qquickdroparea.cpp b/src/quick/items/qquickdroparea.cpp index 51037508e0..92275b1655 100644 --- a/src/quick/items/qquickdroparea.cpp +++ b/src/quick/items/qquickdroparea.cpp @@ -559,11 +559,12 @@ QStringList QQuickDropEvent::formats() const void QQuickDropEvent::getDataAsString(QQmlV4Function *args) { if (args->length() != 0) { - QV4::Value v = (*args)[0]; - QString format = v.toQString(); + QV4::ExecutionEngine *v4 = args->v4engine(); + QV4::Scope scope(v4); + QV4::ScopedValue v(scope, (*args)[0]); + QString format = v->toQString(); QString rv = QString::fromUtf8(event->mimeData()->data(format)); - QV4::ExecutionEngine *v4 = QV8Engine::getV4(args->engine()); - args->setReturnValue(QV4::Value::fromString(v4, rv)); + args->setReturnValue(QV4::Value::fromString(v4, rv).asReturnedValue()); } } @@ -577,9 +578,10 @@ void QQuickDropEvent::accept(QQmlV4Function *args) Qt::DropAction action = event->dropAction(); if (args->length() >= 1) { - QV4::Value v = (*args)[0]; - if (v.isInt32()) - action = Qt::DropAction(v.integerValue()); + QV4::Scope scope(args->v4engine()); + QV4::ScopedValue v(scope, (*args)[0]); + if (v->isInt32()) + action = Qt::DropAction(v->integerValue()); } // get action from arguments. |