diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-05-04 14:43:48 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-05-04 12:54:52 +0000 |
commit | f61855a60f871f96bf910efd4bf3b1080faa8218 (patch) | |
tree | e23c7ea9f8c70b33255be717d7970a0371ac9b4f /src/quicktemplates2 | |
parent | 080284b544e02ae6824c7404612aa4a662421dcf (diff) |
QQuickContainer: add missing null check
This fixes 'make qmltypes' for the templates. qmlplugindump creates
and instance of each type, and the plain container template does not
have a content item.
Change-Id: I20c2f5f23ded9745fe0b579c31f5483eae18731e
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2')
-rw-r--r-- | src/quicktemplates2/qquickcontainer.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/quicktemplates2/qquickcontainer.cpp b/src/quicktemplates2/qquickcontainer.cpp index 6c0e6df5..f17c56f1 100644 --- a/src/quicktemplates2/qquickcontainer.cpp +++ b/src/quicktemplates2/qquickcontainer.cpp @@ -85,12 +85,14 @@ void QQuickContainerPrivate::cleanup() QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::Destroyed | QQuickItemPrivate::Parent | QQuickItemPrivate::SiblingOrder); } - QQuickItem *focusItem = QQuickItemPrivate::get(contentItem)->subFocusItem; - if (focusItem && window) - QQuickWindowPrivate::get(window)->clearFocusInScope(contentItem, focusItem, Qt::OtherFocusReason); + if (contentItem) { + QQuickItem *focusItem = QQuickItemPrivate::get(contentItem)->subFocusItem; + if (focusItem && window) + QQuickWindowPrivate::get(window)->clearFocusInScope(contentItem, focusItem, Qt::OtherFocusReason); - q->contentItemChange(nullptr, contentItem); - delete contentItem; + q->contentItemChange(nullptr, contentItem); + delete contentItem; + } QObject::disconnect(contentModel, &QQmlObjectModel::countChanged, q, &QQuickContainer::countChanged); QObject::disconnect(contentModel, &QQmlObjectModel::childrenChanged, q, &QQuickContainer::contentChildrenChanged); |