From 0252d05d06f450b2f2783c905c424d24725fc70a Mon Sep 17 00:00:00 2001 From: Oleg Yadrov Date: Wed, 28 Dec 2016 14:40:11 -0800 Subject: PathView: fix crash on path remove There was no check if new path is a valid object Task-number: QTBUG-53917 Change-Id: I2fd9534c1d34633243d16eda56a2b07e18dabe16 Reviewed-by: Laszlo Agocs Reviewed-by: Shawn Rutledge Reviewed-by: Robin Burchell --- src/quick/items/qquickpathview.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'src/quick/items/qquickpathview.cpp') diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp index 11881ae0ab..03596f13e9 100644 --- a/src/quick/items/qquickpathview.cpp +++ b/src/quick/items/qquickpathview.cpp @@ -704,16 +704,23 @@ void QQuickPathView::setPath(QQuickPath *path) qmlobject_disconnect(d->path, QQuickPath, SIGNAL(changed()), this, QQuickPathView, SLOT(pathUpdated())); d->path = path; - qmlobject_connect(d->path, QQuickPath, SIGNAL(changed()), - this, QQuickPathView, SLOT(pathUpdated())); - if (d->isValid() && isComponentComplete()) { + + if (path) { + qmlobject_connect(d->path, QQuickPath, SIGNAL(changed()), + this, QQuickPathView, SLOT(pathUpdated())); + } + + if (isComponentComplete()) { d->clear(); - if (d->attType) { - d->attType->release(); - d->attType = nullptr; + if (d->isValid()) { + if (d->attType) { + d->attType->release(); + d->attType = nullptr; + } + d->regenerate(); } - d->regenerate(); } + emit pathChanged(); } -- cgit v1.2.3 From 3057ec0447943fe022b66a2d19e13d94f9183a7c Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Thu, 5 Jan 2017 20:27:53 +0100 Subject: Port existing qmlInfo callers to qmlWarning Now that qmlInfo actually reports info messages, we want to change existing callers to use warning-level messages to preserve the original message level. This was done through: perl -p -i -e "s/qmlInfo\(/qmlWarning\(/" **/*.{cpp,h,qdoc} .. with a little care taken to only add the hunks that should be changed. Change-Id: I511cee11ce0a26ec1048cd2b84c7536b812a0d89 Reviewed-by: Simon Hausmann --- src/quick/items/qquickpathview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/quick/items/qquickpathview.cpp') diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp index 03596f13e9..53e547fe98 100644 --- a/src/quick/items/qquickpathview.cpp +++ b/src/quick/items/qquickpathview.cpp @@ -137,7 +137,7 @@ QQuickItem *QQuickPathViewPrivate::getItem(int modelIndex, qreal z, bool async) if (!delegateValidated) { delegateValidated = true; QObject* delegate = q->delegate(); - qmlInfo(delegate ? delegate : q) << QQuickPathView::tr("Delegate must be of Item type"); + qmlWarning(delegate ? delegate : q) << QQuickPathView::tr("Delegate must be of Item type"); } } } else { -- cgit v1.2.3