aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2016-01-26 12:47:02 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2016-01-28 18:45:14 +0000
commitc14c3a1054f68886413e8698cdf67275d91d3e58 (patch)
tree4634b40103876e87fdb0e321b452947ec9fe9cfb /src
parent570c848e6d546d35b408770e1b1d1d954268d519 (diff)
PathView: don't leak item references
Every getItem() call increases the reference count. If getItem() was called on an item that was already managed, we must pair it with a call to releaseItem() in order to keep the reference count in sync. Change-Id: I897d19c77bc0c58717065cbe925c45a14153ad0b Task-number: QTBUG-50655 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/quick/items/qquickpathview.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp
index 05bf50574c..deb5582495 100644
--- a/src/quick/items/qquickpathview.cpp
+++ b/src/quick/items/qquickpathview.cpp
@@ -1978,6 +1978,7 @@ void QQuickPathView::refill()
break;
}
if (d->items.contains(item)) {
+ d->releaseItem(item);
break; //Otherwise we'd "re-add" it, and get confused
}
if (d->currentIndex == idx) {
@@ -2008,6 +2009,7 @@ void QQuickPathView::refill()
break;
}
if (d->items.contains(item)) {
+ d->releaseItem(item);
break; //Otherwise we'd "re-add" it, and get confused
}
if (d->currentIndex == idx) {
@@ -2049,6 +2051,8 @@ void QQuickPathView::refill()
int lastListIdx = d->items.indexOf(lastItem);
d->items.insert(lastListIdx + 1, item);
d->updateItem(item, nextPos);
+ } else {
+ d->releaseItem(item);
}
lastItem = item;