aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2011-05-30 15:26:06 +1000
committerMartin Jones <martin.jones@nokia.com>2011-05-30 16:14:51 +1000
commit806f031efeda71d3f4d7d2f949b437493e79cf52 (patch)
tree382b37df75e8340326dfe5b520c0bb7a1202147e /src
parentce77f3adb8c144504f4cd2422b1fe387bce08b70 (diff)
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 (cherry picked from commit b9d5cb9334e7d9da71af169802a01f8d344151a7)
Diffstat (limited to 'src')
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp4
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp4
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview.cpp4
3 files changed, 9 insertions, 3 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index a3395a4fef..7e8472a8b8 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 ef6b03276e..29cb76e819 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 be2bd60fcd..65ce3b2737 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;
}