summaryrefslogtreecommitdiffstats
path: root/src/script/bridge/qscriptqobject.cpp
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-07-13 09:18:22 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-07-13 09:25:57 (GMT)
commita267b590d17d1e7088acf44a8ba7e307f898ccb1 (patch)
tree11b7a48ef6251b6184f4a38303cf99a8b5fb2cdc /src/script/bridge/qscriptqobject.cpp
parent2859da9f22517099ce5d193398b7cc417a9c54d7 (diff)
downloadQt-a267b590d17d1e7088acf44a8ba7e307f898ccb1.zip
Qt-a267b590d17d1e7088acf44a8ba7e307f898ccb1.tar.gz
Qt-a267b590d17d1e7088acf44a8ba7e307f898ccb1.tar.bz2
add GC marking guards
Caller is responsible for calling marked() before mark(), otherwise you might get infinite recursion.
Diffstat (limited to 'src/script/bridge/qscriptqobject.cpp')
-rw-r--r--src/script/bridge/qscriptqobject.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp
index a17daea..ff58102 100644
--- a/src/script/bridge/qscriptqobject.cpp
+++ b/src/script/bridge/qscriptqobject.cpp
@@ -82,9 +82,9 @@ struct QObjectConnection
}
#endif
}
- if (receiver)
+ if (receiver && !receiver.marked())
receiver.mark();
- if (slot)
+ if (slot && !slot.marked())
slot.mark();
}
};
@@ -234,7 +234,13 @@ JSC::CallType QtFunction::getCallData(JSC::CallData &callData)
void QtFunction::mark()
{
- data->object.mark();
+ Q_ASSERT(!marked());
+ if (data->object && !data->object.marked()) {
+ // FIXME: Causes infinite recursion because the object will mark this function,
+ // which will again mark the object, and so on. Need an "is marking" flag.
+// data->object.mark();
+ }
+ JSC::InternalFunction::mark();
}
QScriptObject *QtFunction::wrapperObject() const
@@ -1498,10 +1504,13 @@ void QObjectDelegate::getPropertyNames(QScriptObject *object, JSC::ExecState *ex
void QObjectDelegate::mark(QScriptObject *object)
{
QHash<QByteArray, JSC::JSValue>::const_iterator it;
- for (it = data->cachedMembers.constBegin(); it != data->cachedMembers.constEnd(); ++it)
- JSC::asObject(it.value())->mark();
+ for (it = data->cachedMembers.constBegin(); it != data->cachedMembers.constEnd(); ++it) {
+ JSC::JSValue val = it.value();
+ if (val && !val.marked())
+ val.mark();
+ }
- object->JSC::JSObject::mark();
+ QScriptObjectDelegate::mark(object);
}
static JSC::JSValue JSC_HOST_CALL qobjectProtoFuncFindChild(JSC::ExecState *exec, JSC::JSObject*,