summaryrefslogtreecommitdiffstats
path: root/src/script/bridge/qscriptdeclarativeclass.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-01-15 04:12:20 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-01-15 04:12:20 (GMT)
commitbd3caa48edf2cd53e561cec7ee7ccec6748a4843 (patch)
tree8dc29129364253ec53143b3cc22e3412839dd800 /src/script/bridge/qscriptdeclarativeclass.cpp
parent3b0a9dbfa3683bfb6bdc484ed225267ca56bfa9b (diff)
downloadQt-bd3caa48edf2cd53e561cec7ee7ccec6748a4843.zip
Qt-bd3caa48edf2cd53e561cec7ee7ccec6748a4843.tar.gz
Qt-bd3caa48edf2cd53e561cec7ee7ccec6748a4843.tar.bz2
Fix possible crash
The QScriptValue does not always have a valid QScriptEngine.
Diffstat (limited to 'src/script/bridge/qscriptdeclarativeclass.cpp')
-rw-r--r--src/script/bridge/qscriptdeclarativeclass.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/script/bridge/qscriptdeclarativeclass.cpp b/src/script/bridge/qscriptdeclarativeclass.cpp
index 0df9a49..ce2fc23 100644
--- a/src/script/bridge/qscriptdeclarativeclass.cpp
+++ b/src/script/bridge/qscriptdeclarativeclass.cpp
@@ -90,6 +90,11 @@ QScriptDeclarativeClass::Value::Value(QScriptContext *ctxt, const QString &value
new (this) JSC::JSValue(JSC::jsString(QScriptEnginePrivate::frameForContext(ctxt), value));
}
+QScriptDeclarativeClass::Value::Value(QScriptContext *ctxt, const QScriptValue &value)
+{
+ new (this) JSC::JSValue(QScriptEnginePrivate::get(ctxt->engine())->scriptValueToJSCValue(value));
+}
+
QScriptDeclarativeClass::Value::Value(QScriptEngine *eng, int value)
{
new (this) JSC::JSValue(QScriptEnginePrivate::get(eng)->currentFrame, value);
@@ -120,12 +125,11 @@ QScriptDeclarativeClass::Value::Value(QScriptEngine *eng, const QString &value)
new (this) JSC::JSValue(JSC::jsString(QScriptEnginePrivate::get(eng)->currentFrame, value));
}
-QScriptDeclarativeClass::Value::Value(const QScriptValue &value)
+QScriptDeclarativeClass::Value::Value(QScriptEngine *eng, const QScriptValue &value)
{
- new (this) JSC::JSValue(QScriptValuePrivate::get(&value)->engine->scriptValueToJSCValue(value));
+ new (this) JSC::JSValue(QScriptEnginePrivate::get(eng)->scriptValueToJSCValue(value));
}
-
QScriptDeclarativeClass::Value::~Value()
{
((JSC::JSValue *)(this))->~JSValue();