diff options
author | Martin Jones <martin.jones@nokia.com> | 2011-05-30 05:26:06 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2011-05-30 05:26:06 (GMT) |
commit | b9d5cb9334e7d9da71af169802a01f8d344151a7 (patch) | |
tree | 5babb1fd2633d5da0121720dcac0a0ec8fedd8ac /src/declarative | |
parent | f75fda0365a4e4bf1f26dedc40d96d37a2599174 (diff) | |
download | Qt-b9d5cb9334e7d9da71af169802a01f8d344151a7.zip Qt-b9d5cb9334e7d9da71af169802a01f8d344151a7.tar.gz Qt-b9d5cb9334e7d9da71af169802a01f8d344151a7.tar.bz2 |
ListView segmentation fault when setting highlight to null
Setting view highlight to null due to focus change caused a crash
since graphicsview accessed the highlight item after it had been
deleted. Remove highlight item from scene and deleteLater(),
as is done for delegates.
Change-Id: I5bfd59095aca90d3adca805bc4f61c92c192ee1b
Task-number: QTBUG-19509
Reviewed-by: Bea Lam
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativegridview.cpp | 4 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativelistview.cpp | 4 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativepathview.cpp | 4 |
3 files changed, 9 insertions, 3 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 34925f1..36f6e29 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -818,7 +818,9 @@ void QDeclarativeGridViewPrivate::createHighlight() if (highlight) { if (trackedItem == highlight) trackedItem = 0; - delete highlight->item; + if (highlight->item->scene()) + highlight->item->scene()->removeItem(highlight->item); + highlight->item->deleteLater(); delete highlight; highlight = 0; delete highlightXAnimator; diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index b52b6fc..225b031 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -943,7 +943,9 @@ void QDeclarativeListViewPrivate::createHighlight() if (highlight) { if (trackedItem == highlight) trackedItem = 0; - delete highlight->item; + if (highlight->item->scene()) + highlight->item->scene()->removeItem(highlight->item); + highlight->item->deleteLater(); delete highlight; highlight = 0; delete highlightPosAnimator; diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 79e52cd..94f128d 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -203,7 +203,9 @@ void QDeclarativePathViewPrivate::createHighlight() bool changed = false; if (highlightItem) { - delete highlightItem; + if (highlightItem->scene()) + highlightItem->scene()->removeItem(highlightItem); + highlightItem->deleteLater(); highlightItem = 0; changed = true; } |