diff options
Diffstat (limited to 'src/qml/types/qqmldelegatemodel.cpp')
-rw-r--r-- | src/qml/types/qqmldelegatemodel.cpp | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index be4258cdfd..c4fabbedcc 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -62,21 +62,26 @@ namespace QV4 { namespace Heap { struct DelegateModelGroupFunction : FunctionObject { - DelegateModelGroupFunction(QV4::ExecutionContext *scope, uint flag, QV4::ReturnedValue (*code)(QQmlDelegateModelItem *item, uint flag, const QV4::Value &arg)); + void init(QV4::ExecutionContext *scope, uint flag, QV4::ReturnedValue (*code)(QQmlDelegateModelItem *item, uint flag, const QV4::Value &arg)); - uint flag; QV4::ReturnedValue (*code)(QQmlDelegateModelItem *item, uint flag, const QV4::Value &arg); + uint flag; }; struct QQmlDelegateModelGroupChange : Object { - QQmlDelegateModelGroupChange() {} + void init() { Object::init(); } - QQmlChangeSet::Change change; + QQmlChangeSet::ChangeData change; }; struct QQmlDelegateModelGroupChangeArray : Object { - QQmlDelegateModelGroupChangeArray(const QVector<QQmlChangeSet::Change> &changes); - QVector<QQmlChangeSet::Change> changes; + void init(const QVector<QQmlChangeSet::Change> &changes); + void destroy() { + delete changes; + Object::destroy(); + } + + QVector<QQmlChangeSet::Change> *changes; }; @@ -105,11 +110,11 @@ struct DelegateModelGroupFunction : QV4::FunctionObject } }; -Heap::DelegateModelGroupFunction::DelegateModelGroupFunction(QV4::ExecutionContext *scope, uint flag, QV4::ReturnedValue (*code)(QQmlDelegateModelItem *item, uint flag, const QV4::Value &arg)) - : QV4::Heap::FunctionObject(scope, QStringLiteral("DelegateModelGroupFunction")) - , flag(flag) - , code(code) +void Heap::DelegateModelGroupFunction::init(QV4::ExecutionContext *scope, uint flag, QV4::ReturnedValue (*code)(QQmlDelegateModelItem *item, uint flag, const QV4::Value &arg)) { + QV4::Heap::FunctionObject::init(scope, QStringLiteral("DelegateModelGroupFunction")); + this->flag = flag; + this->code = code; } } @@ -1865,9 +1870,10 @@ QV4::ReturnedValue QQmlDelegateModelItem::get_index(QQmlDelegateModelItem *thisI DEFINE_OBJECT_VTABLE(QQmlDelegateModelItemObject); -QV4::Heap::QQmlDelegateModelItemObject::~QQmlDelegateModelItemObject() +void QV4::Heap::QQmlDelegateModelItemObject::destroy() { item->Dispose(); + Object::destroy(); } @@ -3256,8 +3262,8 @@ public: return engine->memoryManager->allocObject<QQmlDelegateModelGroupChangeArray>(changes); } - quint32 count() const { return d()->changes.count(); } - const QQmlChangeSet::Change &at(int index) const { return d()->changes.at(index); } + quint32 count() const { return d()->changes->count(); } + const QQmlChangeSet::Change &at(int index) const { return d()->changes->at(index); } static QV4::ReturnedValue getIndexed(const QV4::Managed *m, uint index, bool *hasProperty) { @@ -3299,9 +3305,10 @@ public: } }; -QV4::Heap::QQmlDelegateModelGroupChangeArray::QQmlDelegateModelGroupChangeArray(const QVector<QQmlChangeSet::Change> &changes) - : changes(changes) +void QV4::Heap::QQmlDelegateModelGroupChangeArray::init(const QVector<QQmlChangeSet::Change> &changes) { + Object::init(); + this->changes = new QVector<QQmlChangeSet::Change>(changes); QV4::Scope scope(internalClass->engine); QV4::ScopedObject o(scope, this); o->setArrayType(QV4::Heap::ArrayData::Custom); |