diff options
Diffstat (limited to 'src/qml/jsruntime/qv4engine.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index d885c28166..a900e710c2 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -303,15 +303,19 @@ ExecutionEngine::ExecutionEngine(QJSEngine *jsEngine) memoryManager = new QV4::MemoryManager(this); if (maxCallDepth == -1) { - ok = false; - maxCallDepth = qEnvironmentVariableIntValue("QV4_MAX_CALL_DEPTH", &ok); - if (!ok || maxCallDepth <= 0) { + if (qEnvironmentVariableIsSet("QV4_CRASH_ON_STACKOVERFLOW")) { + maxCallDepth = std::numeric_limits<qint32>::max(); + } else { + ok = false; + maxCallDepth = qEnvironmentVariableIntValue("QV4_MAX_CALL_DEPTH", &ok); + if (!ok || maxCallDepth <= 0) { #if defined(QT_NO_DEBUG) && !defined(__SANITIZE_ADDRESS__) && !__has_feature(address_sanitizer) - maxCallDepth = 1234; + maxCallDepth = 1234; #else - // no (tail call) optimization is done, so there'll be a lot mare stack frames active - maxCallDepth = 200; + // no (tail call) optimization is done, so there'll be a lot mare stack frames active + maxCallDepth = 200; #endif + } } } Q_ASSERT(maxCallDepth > 0); @@ -1457,7 +1461,7 @@ static QVariant toVariant(QV4::ExecutionEngine *e, const QV4::Value &value, int if (const QV4::VariantObject *v = value.as<QV4::VariantObject>()) return v->d()->data(); - if (typeHint == QVariant::Bool) + if (typeHint == QMetaType::Bool) return QVariant(value.toBoolean()); if (typeHint == QMetaType::QJsonValue) @@ -1554,7 +1558,7 @@ static QVariant toVariant(QV4::ExecutionEngine *e, const QV4::Value &value, int if (String *s = value.stringValue()) { const QString &str = s->toQString(); // QChars are stored as a strings - if (typeHint == QVariant::Char && str.size() == 1) + if (typeHint == QMetaType::QChar && str.size() == 1) return str.at(0); return str; } @@ -1853,7 +1857,7 @@ QV4::ReturnedValue ExecutionEngine::metaTypeToJS(int type, const void *data) Q_ASSERT(data != nullptr); QVariant variant(type, data); - if (QMetaType::Type(variant.type()) == QMetaType::QVariant) { + if (QMetaType::Type(variant.userType()) == QMetaType::QVariant) { // unwrap it: this is tested in QJSEngine, and makes the most sense for // end-user code too. return variantToJS(this, *reinterpret_cast<const QVariant*>(data)); @@ -1970,11 +1974,12 @@ void ExecutionEngine::initQmlGlobalObject() void ExecutionEngine::initializeGlobal() { QV4::Scope scope(this); - QV4::GlobalExtensions::init(globalObject, QJSEngine::AllExtensions); QV4::ScopedObject qt(scope, memoryManager->allocate<QV4::QtObject>(qmlEngine())); globalObject->defineDefaultProperty(QStringLiteral("Qt"), qt); + QV4::GlobalExtensions::init(globalObject, QJSEngine::AllExtensions); + #if QT_CONFIG(qml_locale) QQmlLocale::registerStringLocaleCompare(this); QQmlDateExtension::registerExtension(this); |