diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-06-09 21:56:31 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-06-10 16:03:17 +0000 |
commit | a648eb96dbef983557ffb78618d63987c27390a6 (patch) | |
tree | 2ea8c1b78e515f46d41f1eb8f6a4bfe5ad8511d3 /src/quicktemplates2/qquickstackview_p.cpp | |
parent | 67133d609dca4ac845906dfa49176e50ec03135a (diff) |
QQuickStackView: allocate incubators on the stack
Don't keep unnecessary incubator instances alive for all loaded stack
elements. Just allocate it on the stack and let it go out of scope. We
only use incubators to synchronously to initialize properties during
construction.
Change-Id: Ide56435ec9c640b9e49356f01476e36120dff5d7
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickstackview_p.cpp')
-rw-r--r-- | src/quicktemplates2/qquickstackview_p.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/quicktemplates2/qquickstackview_p.cpp b/src/quicktemplates2/qquickstackview_p.cpp index 5a83f5e5..96f70d80 100644 --- a/src/quicktemplates2/qquickstackview_p.cpp +++ b/src/quicktemplates2/qquickstackview_p.cpp @@ -72,7 +72,7 @@ private: QQuickStackElement::QQuickStackElement() : QQuickItemViewTransitionableItem(nullptr), index(-1), init(false), removal(false), ownItem(false), ownComponent(false), widthValid(false), heightValid(false), - context(nullptr), component(nullptr), incubator(nullptr), view(nullptr), + context(nullptr), component(nullptr), view(nullptr), status(QQuickStackView::Inactive) { } @@ -107,7 +107,6 @@ QQuickStackElement::~QQuickStackElement() } delete context; - delete incubator; } QQuickStackElement *QQuickStackElement::fromString(const QString &str, QQuickStackView *view) @@ -144,9 +143,8 @@ bool QQuickStackElement::load(QQuickStackView *parent) context = new QQmlContext(creationContext); context->setContextObject(parent); - delete incubator; - incubator = new QQuickStackIncubator(this); - component->create(*incubator, context); + QQuickStackIncubator incubator(this); + component->create(incubator, context); if (component->isError()) qWarning() << qPrintable(component->errorString().trimmed()); } else { |