on xenial help sign in
Don't do stuff if our parent is gone
81eda2bAlbert Astals
plugins/ListViewWithPageHeader/listviewwithpageheader.cpp+17
@@ -479,6 +479,12 @@ void ListViewWithPageHeader::componentComplete()
479
479
480void ListViewWithPageHeader::viewportMoved(Qt::Orientations orient)
480void ListViewWithPageHeader::viewportMoved(Qt::Orientations orient)
481{
481{
482+ // Check we are not being taken down and don't paint anything
483+ // TODO Check if we still need this in 5.2
484+ // For reproduction just inifnite loop testDash or testDashContent
485+ if (!QQmlEngine::contextForObject(this)->parentContext())
486+ return;
487+
482 QQuickFlickable::viewportMoved(orient);
488 QQuickFlickable::viewportMoved(orient);
483// qDebug() << "ListViewWithPageHeader::viewportMoved" << contentY();
489// qDebug() << "ListViewWithPageHeader::viewportMoved" << contentY();
484 qreal diff = m_previousContentY - contentY();
490 qreal diff = m_previousContentY - contentY();
@@ -855,6 +861,11 @@ void ListViewWithPageHeader::itemCreated(int modelIndex, QObject *object)
855 }
861 }
856#endif
862#endif
857// qDebug() << "ListViewWithPageHeader::itemCreated" << modelIndex << item;
863// qDebug() << "ListViewWithPageHeader::itemCreated" << modelIndex << item;
864+ // Check we are not being taken down and don't paint anything
865+ // TODO Check if we still need this in 5.2
866+ // For reproduction just inifnite loop testDash or testDashContent
867+ if (!QQmlEngine::contextForObject(this)->parentContext())
868+ return;
858
869
859 item->setParentItem(m_clipItem);
870 item->setParentItem(m_clipItem);
860 QQmlContext *context = QQmlEngine::contextForObject(item)->parentContext();
871 QQmlContext *context = QQmlEngine::contextForObject(item)->parentContext();
@@ -1235,6 +1246,12 @@ void ListViewWithPageHeader::layout()
1235
1246
1236void ListViewWithPageHeader::updatePolish()
1247void ListViewWithPageHeader::updatePolish()
1237{
1248{
1249+ // Check we are not being taken down and don't paint anything
1250+ // TODO Check if we still need this in 5.2
1251+ // For reproduction just inifnite loop testDash or testDashContent
1252+ if (!QQmlEngine::contextForObject(this)->parentContext())
1253+ return;
1254+
1238 Q_FOREACH(ListItem *item, m_itemsToRelease)
1255 Q_FOREACH(ListItem *item, m_itemsToRelease)
1239 reallyReleaseItem(item);
1256 reallyReleaseItem(item);
1240 m_itemsToRelease.clear();
1257 m_itemsToRelease.clear();
tests/qmltests/Dash/tst_DashContent.qml−7
@@ -125,13 +125,6 @@ Item {
125
125
126 var dashContentList = findChild(dashContent, "dashContentList");
126 var dashContentList = findChild(dashContent, "dashContentList");
127 verify(dashContentList != undefined);
127 verify(dashContentList != undefined);
128− // TODO For Qt 5.2 remove this wait
129− // and the tryCompare and see if it still crashes when
130− // looping the test
131− wait(1000);
132− if (dashContentList.currentItem !== null) {
133− tryCompare(dashContentList.currentItem, "moving", false);
134− }
135 scopesModel.clear();
128 scopesModel.clear();
136 // wait for dash to empty scopes.
129 // wait for dash to empty scopes.
137 tryCompare(dashContentList, "count", 0);
130 tryCompare(dashContentList, "count", 0);