From fb4e81bdc692efe0db9aa38dd2b941578c0f0370 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 18 Nov 2009 14:54:10 +0100 Subject: 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 --- src/script/api/qscriptengine.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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(); #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); -- cgit v0.12