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') 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