diff options
Diffstat (limited to 'src/lib/corelib/language/scriptimporter.cpp')
-rw-r--r-- | src/lib/corelib/language/scriptimporter.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/corelib/language/scriptimporter.cpp b/src/lib/corelib/language/scriptimporter.cpp index 1b012f3c3..fdb0689ad 100644 --- a/src/lib/corelib/language/scriptimporter.cpp +++ b/src/lib/corelib/language/scriptimporter.cpp @@ -142,10 +142,11 @@ JSValue ScriptImporter::importSourceCode(const QString &sourceCode, const QStrin code = QLatin1String("(function(){\n") + sourceCode + extractor.suffix(); } - JSValue result = m_engine->evaluate(JsValueOwner::Caller, code, filePath, 0); + ScopedJsValue result(m_engine->context(), + m_engine->evaluate(JsValueOwner::Caller, code, filePath, 0)); throwOnEvaluationError(m_engine, [&filePath] () { return CodeLocation(filePath, 0); }); copyProperties(m_engine->context(), result, targetObject); - return result; + return result.release(); } void ScriptImporter::copyProperties(JSContext *ctx, const JSValue &src, JSValue &dst) |