aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/v4/main.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/v4/main.cpp b/tools/v4/main.cpp
index b612a5d1ab..3404de2c30 100644
--- a/tools/v4/main.cpp
+++ b/tools/v4/main.cpp
@@ -117,9 +117,11 @@ DEFINE_MANAGED_VTABLE(GC);
static void showException(QV4::ExecutionContext *ctx, const QV4::Exception &exception)
{
- QV4::ErrorObject *e = exception.value().asErrorObject();
+ QV4::Scope scope(ctx);
+ QV4::ScopedValue ex(scope, exception.value());
+ QV4::ErrorObject *e = ex->asErrorObject();
if (!e) {
- std::cerr << "Uncaught exception: " << qPrintable(exception.value().toString(ctx)->toQString()) << std::endl;
+ std::cerr << "Uncaught exception: " << qPrintable(ex->toString(ctx)->toQString()) << std::endl;
} else {
std::cerr << "Uncaught exception: " << qPrintable(QV4::Value::fromReturnedValue(e->get(ctx->engine->newString(QStringLiteral("message")), 0)).toString(ctx)->toQString()) << std::endl;
}
@@ -187,6 +189,7 @@ int main(int argc, char *argv[])
QV4::ExecutionEngine vm(iSelFactory);
QV4::ExecutionContext *ctx = vm.rootContext;
+ QV4::Scope scope(ctx);
QV4::Object *globalObject = vm.globalObject;
QV4::Object *print = new (ctx->engine->memoryManager) builtins::Print(ctx);
@@ -204,10 +207,10 @@ int main(int argc, char *argv[])
QV4::Script script(ctx, code, fn);
script.parseAsBinding = runAsQml;
script.parse();
- QV4::Value result = script.run();
- if (!result.isUndefined()) {
+ QV4::ScopedValue result(scope, script.run());
+ if (!result->isUndefined()) {
if (! qgetenv("SHOW_EXIT_VALUE").isEmpty())
- std::cout << "exit value: " << qPrintable(result.toString(ctx)->toQString()) << std::endl;
+ std::cout << "exit value: " << qPrintable(result->toString(ctx)->toQString()) << std::endl;
}
} catch (QV4::Exception& ex) {
ex.accept(ctx);