From 3cc96b513fcea6258fbeb8a5ddbc0fd22faa7b73 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 15 Jul 2009 15:36:27 +0200 Subject: don't try to be so clever If we implement the ability to change the global object, the global object pointer can change, so we need to keep a reference to the object if it's stored in a QScriptValue. --- src/script/api/qscriptvalue.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index 0232dab..68ad93a 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -284,11 +284,9 @@ void QScriptValuePrivate::initFromJSCValue(JSC::JSValue value) JSC::JSCell *cell = value.asCell(); Q_ASSERT(engine != 0); QScriptEnginePrivate *eng_p = QScriptEnginePrivate::get(engine); - if (value != eng_p->globalObject) { - if (!eng_p->keepAliveValues.contains(cell)) - eng_p->keepAliveValues[cell] = 0; - eng_p->keepAliveValues[cell].ref(); - } + if (!eng_p->keepAliveValues.contains(cell)) + eng_p->keepAliveValues[cell] = 0; + eng_p->keepAliveValues[cell].ref(); } } @@ -401,8 +399,7 @@ QScriptValue::~QScriptValue() if (d_ptr->engine && d_ptr->isJSC() && !JSC::JSImmediate::isImmediate(d_ptr->jscValue)) { QScriptEnginePrivate *eng_p = QScriptEnginePrivate::get(d_ptr->engine); - if (d_ptr->jscValue != eng_p->globalObject) - eng_p->releaseJSCValue(d_ptr->jscValue); + eng_p->releaseJSCValue(d_ptr->jscValue); } delete d_ptr; d_ptr = 0; -- cgit v0.12