diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2014-11-13 21:38:25 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-11-21 19:32:23 +0100 |
commit | 2784a68d64519ccc5d01b6c1378207572cf1ebcd (patch) | |
tree | b66287687e7311a24253d60e18bcba829fb475ad /src/qml/jsruntime/qv4qobjectwrapper_p.h | |
parent | 2cb6d1bf32e017026f618dcfdbef3980f5363656 (diff) |
Cleanup destruction of heap objects
Generate the code from a macro instead of duplicating boiler
plate code. Operate on Heap::Base instead of Managed.
Change-Id: I84c5a705980899be3e5b931a093645e50d3923bf
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4qobjectwrapper_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper_p.h | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/qml/jsruntime/qv4qobjectwrapper_p.h b/src/qml/jsruntime/qv4qobjectwrapper_p.h index f30a98ef43..7f271a8680 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper_p.h +++ b/src/qml/jsruntime/qv4qobjectwrapper_p.h @@ -127,7 +127,7 @@ private: static PropertyAttributes query(const Managed *, String *name); static void advanceIterator(Managed *m, ObjectIterator *it, String *&name, uint *index, Property *p, PropertyAttributes *attributes); static void markObjects(Heap::Base *that, QV4::ExecutionEngine *e); - static void destroy(Managed *that); + static void destroy(Heap::Base *that); static ReturnedValue method_connect(CallContext *ctx); static ReturnedValue method_disconnect(CallContext *ctx); @@ -136,6 +136,7 @@ private: struct Q_QML_EXPORT QObjectMethod : public QV4::FunctionObject { V4_OBJECT2(QObjectMethod, QV4::FunctionObject) + V4_NEEDS_DESTROY enum { DestroyMethod = -1, ToStringMethod = -2 }; @@ -152,26 +153,15 @@ 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<QObjectMethod *>(that)->d()->~Data(); - } }; struct QmlSignalHandler : public QV4::Object { V4_OBJECT2(QmlSignalHandler, QV4::Object) - + V4_NEEDS_DESTROY int signalIndex() const { return d()->signalIndex; } QObject *object() const { return d()->object.data(); } - -private: - - static void destroy(Managed *that) - { - static_cast<QmlSignalHandler *>(that)->d()->~Data(); - } }; class MultiplyWrappedQObjectMap : public QObject, |