diff options
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 9 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4engine_p.h | 7 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index a247f85761..92993259ec 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -1623,6 +1623,15 @@ QV4::ReturnedValue ExecutionEngine::metaTypeToJS(int type, const void *data) return 0; } +#ifndef QT_NO_DEBUG +void ExecutionEngine::assertObjectBelongsToEngine(const Value &v) +{ + if (!v.isObject()) + return; + Q_ASSERT(v.objectValue()->engine() == this); +} +#endif + // Converts a JS value to a meta-type. // data must point to a place that can store a value of the given type. // Returns true if conversion succeeded, false otherwise. diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h index f01579be71..277cbdf1f5 100644 --- a/src/qml/jsruntime/qv4engine_p.h +++ b/src/qml/jsruntime/qv4engine_p.h @@ -340,6 +340,10 @@ public: bool metaTypeFromJS(const Value &value, int type, void *data); QV4::ReturnedValue metaTypeToJS(int type, const void *data); +#ifndef QT_NO_DEBUG + void assertObjectBelongsToEngine(const Value &v); +#endif + private: QmlExtensions *m_qmlExtensions; }; @@ -381,6 +385,9 @@ void Managed::mark(QV4::ExecutionEngine *engine) Q_ASSERT(inUse()); if (markBit()) return; +#ifndef QT_NO_DEBUG + engine->assertObjectBelongsToEngine(*this); +#endif d()->setMarkBit(); engine->pushForGC(d()); } |