aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlmetatype.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-05-23 12:50:39 +0200
committerLars Knoll <lars.knoll@digia.com>2013-05-23 13:12:35 +0200
commitf565649e2eb7b2147eedc698e569ab26f194e0a2 (patch)
tree74665ff8d991996045f8a40b5a51aa15798ebf3d /src/qml/qml/qqmlmetatype.cpp
parentd59a5dd02ab02fcaf21fc87a95ecbb57c8b8c86c (diff)
Fix failing assertion in tst_qqmlecmascript::singletonType
Don't try to call the singleton callback with the current scope but instead execute it well-defined within the scope of the global context. Change-Id: I6b59fad7d466a6070d1c748f909e1d8c0a1045ea Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlmetatype.cpp')
-rw-r--r--src/qml/qml/qqmlmetatype.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp
index c616d5c33e..dbb397462f 100644
--- a/src/qml/qml/qqmlmetatype.cpp
+++ b/src/qml/qml/qqmlmetatype.cpp
@@ -237,11 +237,14 @@ static QHashedString moduleFromUtf8(const char *module)
void QQmlType::SingletonInstanceInfo::init(QQmlEngine *e)
{
+ QV4::ExecutionEngine *v4 = QV8Engine::getV4(e->handle());
+ v4->pushGlobalContext();
if (scriptCallback && scriptApi(e).isUndefined()) {
setScriptApi(e, scriptCallback(e, e));
} else if (qobjectCallback && !qobjectApi(e)) {
setQObjectApi(e, qobjectCallback(e, e));
}
+ v4->popContext();
}
void QQmlType::SingletonInstanceInfo::destroy(QQmlEngine *e)