Remove the right entries from the cache when a GC happens.
Change-Id: I4649b18c4721a5511a404299e771e675c843407b
diff --git a/libs/hwui/PathCache.cpp b/libs/hwui/PathCache.cpp
index 0f22bea..367c627 100644
--- a/libs/hwui/PathCache.cpp
+++ b/libs/hwui/PathCache.cpp
@@ -44,7 +44,9 @@
mCache.setOnEntryRemovedListener(NULL);
for (size_t i = 0; i < pathsToRemove.size(); i++) {
- mCache.removeAt(pathsToRemove.itemAt(i));
+ // This will work because pathsToRemove is sorted
+ // and because the cache is a sorted keyed vector
+ mCache.removeAt(pathsToRemove.itemAt(i) - i);
}
mCache.setOnEntryRemovedListener(this);
}