From 64afa01c32fc1824b280452ceb1ade4f655487f2 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Fri, 9 Sep 2016 10:06:31 +0200 Subject: QML: Introduce destroy() on Base subclasses This removes the destructors of subclasses of Base, making them nearly trivial. Change-Id: Ia6f7d467e87899b5ad37b8709a8f633a51689d59 Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4qobjectwrapper_p.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/qml/jsruntime/qv4qobjectwrapper_p.h') diff --git a/src/qml/jsruntime/qv4qobjectwrapper_p.h b/src/qml/jsruntime/qv4qobjectwrapper_p.h index 076f304fea..37397db55b 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper_p.h +++ b/src/qml/jsruntime/qv4qobjectwrapper_p.h @@ -79,7 +79,7 @@ struct QQmlValueTypeWrapper; struct QObjectWrapper : Object { QObjectWrapper(QObject *object); - ~QObjectWrapper() { qObj.destroy(); } + void destroy() { qObj.destroy(); } QObject *object() const { return qObj.data(); } @@ -89,7 +89,13 @@ private: struct QObjectMethod : FunctionObject { QObjectMethod(QV4::ExecutionContext *scope); - ~QObjectMethod() { qObj.destroy(); } + void destroy() + { + propertyCache = nullptr; + qObj.destroy(); + FunctionObject::destroy(); + } + QQmlRefPointer propertyCache; int index; @@ -109,13 +115,13 @@ struct QMetaObjectWrapper : FunctionObject { int constructorCount; QMetaObjectWrapper(const QMetaObject* metaObject); - ~QMetaObjectWrapper(); + void destroy(); void ensureConstructorsCache(); }; struct QmlSignalHandler : Object { QmlSignalHandler(QObject *object, int signalIndex); - ~QmlSignalHandler() { qObj.destroy(); } + void destroy() { qObj.destroy(); } int signalIndex; QObject *object() const { return qObj.data(); } @@ -130,6 +136,7 @@ private: struct Q_QML_EXPORT QObjectWrapper : public Object { V4_OBJECT2(QObjectWrapper, Object) + V4_NEEDS_DESTROY enum RevisionMode { IgnoreRevision, CheckRevision }; -- cgit v1.2.3