summaryrefslogtreecommitdiffstats
path: root/src/script
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-11-18 13:54:10 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-11-18 14:06:38 (GMT)
commitfb4e81bdc692efe0db9aa38dd2b941578c0f0370 (patch)
tree7b67bf2222058c5d1f3586cd9d3241c87d530d39 /src/script
parente59d974ddf2f2a413611ba4d8594c6413499a645 (diff)
downloadQt-fb4e81bdc692efe0db9aa38dd2b941578c0f0370.zip
Qt-fb4e81bdc692efe0db9aa38dd2b941578c0f0370.tar.gz
Qt-fb4e81bdc692efe0db9aa38dd2b941578c0f0370.tar.bz2
Application object must be constructed before QScriptEngine
This is required due to the switch to the JavaScriptCore-based back-end. Instead of segfaulting somewhere inside JSC::initializeThreading(), call qFatal() when this constraint has been violated. Reviewed-by: Simon Hausmann
Diffstat (limited to 'src/script')
-rw-r--r--src/script/api/qscriptengine.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index d519102..02eb9a3 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -776,7 +776,11 @@ QScriptEnginePrivate::QScriptEnginePrivate()
qMetaTypeId<QObjectList>();
#endif
- JSC::initializeThreading(); // ### hmmm
+ if (!QCoreApplication::instance()) {
+ qFatal("QScriptEngine: Must construct a Q(Core)Application before a QScriptEngine");
+ return;
+ }
+ JSC::initializeThreading();
globalData = JSC::JSGlobalData::create().releaseRef();
globalData->clientData = new QScript::GlobalClientData(this);