diff options
Diffstat (limited to 'src/qml/jsruntime/qv4value.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4value.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/qml/jsruntime/qv4value.cpp b/src/qml/jsruntime/qv4value.cpp index ebd1894016..4ae570c8dc 100644 --- a/src/qml/jsruntime/qv4value.cpp +++ b/src/qml/jsruntime/qv4value.cpp @@ -125,22 +125,20 @@ QString Value::toQStringNoThrow() const Scope scope(ctx); ScopedValue ex(scope); bool caughtException = false; - try { - ScopedValue prim(scope, __qmljs_to_primitive(ValueRef::fromRawValue(this), STRING_HINT)); - if (prim->isPrimitive()) - return prim->toQStringNoThrow(); - } catch (...) { + ScopedValue prim(scope, __qmljs_to_primitive(ValueRef::fromRawValue(this), STRING_HINT)); + if (scope.hasException()) { ex = ctx->catchException(); caughtException = true; + } else if (prim->isPrimitive()) { + return prim->toQStringNoThrow(); } // Can't nest try/catch due to CXX ABI limitations for foreign exception nesting. if (caughtException) { - try { - ScopedValue prim(scope, __qmljs_to_primitive(ex, STRING_HINT)); - if (prim->isPrimitive()) - return prim->toQStringNoThrow(); - } catch(...) { - ctx->catchException(); + ScopedValue prim(scope, __qmljs_to_primitive(ex, STRING_HINT)); + if (scope.hasException()) { + ex = ctx->catchException(); + } else if (prim->isPrimitive()) { + return prim->toQStringNoThrow(); } } return QString(); @@ -398,11 +396,11 @@ WeakValue::~WeakValue() d->deref(); } -void WeakValue::markOnce() +void WeakValue::markOnce(ExecutionEngine *e) { if (!d) return; - d->value.mark(); + d->value.mark(e); } PersistentValuePrivate::PersistentValuePrivate(ReturnedValue v, ExecutionEngine *e, bool weak) |