diff options
author | Erik Verbruggen <erik.verbruggen@digia.com> | 2016-09-09 10:06:31 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2016-10-05 13:15:18 +0000 |
commit | 64afa01c32fc1824b280452ceb1ade4f655487f2 (patch) | |
tree | f5775f2ddfd5145ae26df41a356dfa14172200b7 /src/qml/qml/qqmlcomponent.cpp | |
parent | a166367bd877a55e552e3dfe5cf2ee7fa1561100 (diff) |
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 <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlcomponent.cpp')
-rw-r--r-- | src/qml/qml/qqmlcomponent.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index 3cfbd7bed1..9a993d4ec3 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -1059,8 +1059,8 @@ namespace Heap { struct QmlIncubatorObject : Object { QmlIncubatorObject(QQmlIncubator::IncubationMode = QQmlIncubator::Asynchronous); - ~QmlIncubatorObject() { parent.destroy(); } - QScopedPointer<QQmlComponentIncubator> incubator; + inline void destroy(); + QQmlComponentIncubator *incubator; QQmlQPointer<QObject> parent; QV4::Value valuemap; QV4::Value statusChanged; @@ -1389,7 +1389,7 @@ void QQmlComponent::incubateObject(QQmlV4Function *args) r->d()->qmlContext = v4->qmlContext(); r->d()->parent = parent; - QQmlIncubator *incubator = r->d()->incubator.data(); + QQmlIncubator *incubator = r->d()->incubator; create(*incubator, creationContext()); if (incubator->status() == QQmlIncubator::Null) { @@ -1490,7 +1490,12 @@ QV4::Heap::QmlIncubatorObject::QmlIncubatorObject(QQmlIncubator::IncubationMode { parent.init(); qmlContext = nullptr; - incubator.reset(new QQmlComponentIncubator(this, m)); + incubator = new QQmlComponentIncubator(this, m); +} + +void QV4::Heap::QmlIncubatorObject::destroy() { + delete incubator; + parent.destroy(); } void QV4::QmlIncubatorObject::setInitialState(QObject *o) |