diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-07-15 13:36:27 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-07-15 13:36:27 (GMT) |
commit | 3cc96b513fcea6258fbeb8a5ddbc0fd22faa7b73 (patch) | |
tree | e56a2001f1bea4026e45c228d796e8a3ac1f7f33 /src/script/api | |
parent | 5b0bd9a7313d2c92a0c067b28e3ed2a0d32ef922 (diff) | |
download | Qt-3cc96b513fcea6258fbeb8a5ddbc0fd22faa7b73.zip Qt-3cc96b513fcea6258fbeb8a5ddbc0fd22faa7b73.tar.gz Qt-3cc96b513fcea6258fbeb8a5ddbc0fd22faa7b73.tar.bz2 |
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.
Diffstat (limited to 'src/script/api')
-rw-r--r-- | src/script/api/qscriptvalue.cpp | 11 |
1 files 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; |