diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-09-17 03:46:44 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-09-17 03:46:44 (GMT) |
commit | 7e6b2b2b95bc1db77544b898ec45ea4a2683e435 (patch) | |
tree | 00e90673f5dcb95373558d6a75f08dbb340e388b /src | |
parent | ff075380d7ec1472fcdff06b3f39ffdc02b7f112 (diff) | |
download | Qt-7e6b2b2b95bc1db77544b898ec45ea4a2683e435.zip Qt-7e6b2b2b95bc1db77544b898ec45ea4a2683e435.tar.gz Qt-7e6b2b2b95bc1db77544b898ec45ea4a2683e435.tar.bz2 |
Moving items in a PathView caused PathView.onPath to be set to false.
Check that we no longer hold a reference to the item before setting
onPath to false.
Task-number: QTBUG-13689
Reviewed-by: Michael Brasser
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativepathview.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index dad547f..8f60281 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -141,11 +141,13 @@ void QDeclarativePathViewPrivate::releaseItem(QDeclarativeItem *item) { if (!item || !model) return; - if (QDeclarativePathViewAttached *att = attached(item)) - att->setOnPath(false); QDeclarativeItemPrivate *itemPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(item)); itemPrivate->removeItemChangeListener(this, QDeclarativeItemPrivate::Geometry); - model->release(item); + if (model->release(item) == 0) { + // item was not destroyed, and we no longer reference it. + if (QDeclarativePathViewAttached *att = attached(item)) + att->setOnPath(false); + } } QDeclarativePathViewAttached *QDeclarativePathViewPrivate::attached(QDeclarativeItem *item) |