diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index 147f27ee37..75006bfe5c 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -1765,8 +1765,8 @@ Heap::QObjectMethod::QObjectMethod(QV4::ExecutionContext *scope, QObject *object : Heap::FunctionObject(scope) , object(object) , index(index) - , qmlGlobal(qmlGlobal) { + this->qmlGlobal = qmlGlobal; setVTable(QV4::QObjectMethod::staticVTable()); subtype = WrappedQtMethod; } @@ -1875,7 +1875,7 @@ ReturnedValue QObjectMethod::callInternal(CallData *callData) if (method.isV4Function()) { QV4::ScopedValue rv(scope, QV4::Primitive::undefinedValue()); - QV4::ScopedValue qmlGlobal(scope, d()->qmlGlobal.value()); + QV4::ScopedValue qmlGlobal(scope, d()->qmlGlobal); QQmlV4Function func(callData, rv, qmlGlobal, QmlContextWrapper::getContext(qmlGlobal), v8Engine); @@ -1894,6 +1894,11 @@ ReturnedValue QObjectMethod::callInternal(CallData *callData) } } +void QObjectMethod::markObjects(Heap::Base *that, ExecutionEngine *e) +{ + static_cast(that)->qmlGlobal.mark(e); +} + DEFINE_OBJECT_VTABLE(QObjectMethod); Heap::QmlSignalHandler::QmlSignalHandler(QV4::ExecutionEngine *engine, QObject *object, int signalIndex) diff --git a/src/qml/jsruntime/qv4qobjectwrapper_p.h b/src/qml/jsruntime/qv4qobjectwrapper_p.h index 8f04c341c2..c2822d7522 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper_p.h +++ b/src/qml/jsruntime/qv4qobjectwrapper_p.h @@ -78,7 +78,7 @@ struct QObjectMethod : FunctionObject { QObjectMethod(QV4::ExecutionContext *scope, QObject *object, int index, const ValueRef qmlGlobal); QPointer object; int index; - QV4::PersistentValue qmlGlobal; + Value qmlGlobal; }; struct QmlSignalHandler : Object { @@ -151,6 +151,7 @@ struct Q_QML_EXPORT QObjectMethod : public QV4::FunctionObject ReturnedValue callInternal(CallData *callData); + static void markObjects(Heap::Base *that, QV4::ExecutionEngine *e); static void destroy(Managed *that) { static_cast(that)->d()->~Data();