diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-08-20 12:13:33 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-08-20 12:15:30 (GMT) |
commit | c808a972f8b4beb0527af0c0e669a2aa522ccf3d (patch) | |
tree | 76c019dda65dc91a84f92a5840233e1087a98f39 /src/script/api | |
parent | 4c97aff92561c7d2ab0bd0da920f1c3b708158a1 (diff) | |
download | Qt-c808a972f8b4beb0527af0c0e669a2aa522ccf3d.zip Qt-c808a972f8b4beb0527af0c0e669a2aa522ccf3d.tar.gz Qt-c808a972f8b4beb0527af0c0e669a2aa522ccf3d.tar.bz2 |
make QScriptEngine::objectById() work
It needs to work even when there is no public QScriptValue that
holds a reference to the object.
Diffstat (limited to 'src/script/api')
-rw-r--r-- | src/script/api/qscriptengine.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 1b8573c..32c63ab 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -3706,13 +3706,8 @@ QScriptValue QScriptEngine::toObject(const QScriptValue &value) QScriptValue QScriptEngine::objectById(qint64 id) const { Q_D(const QScriptEngine); - QSet<QScriptValuePrivate*>::const_iterator i = d->attachedScriptValues.constBegin(); - while(i != d->attachedScriptValues.constEnd()) { - if ( (*i)->objectId() == id ) - return QScriptValuePrivate::get(*i); - i++; - } - return QScriptValue(); + // Assumes that the cell was not been garbage collected + return const_cast<QScriptEnginePrivate*>(d)->scriptValueFromJSCValue((JSC::JSCell*)id); } /*! |