Prevents memory leaks by correctly detaching views in AbsListView.

AbsListView can reject views from the recycler's scrap heap but when that
happens the rejected view is not detached from the parent. This can be pretty
bad in the case of TextView since it prevents them from unregistering their
OnPreDrawListeners.
This commit is contained in:
Romain Guy
2009-10-01 15:39:42 -07:00
parent 7f86d58f17
commit 18d1255ebe

View File

@@ -3560,6 +3560,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
// into the scrap heap
int viewType = lp.viewType;
if (!shouldRecycleViewType(viewType)) {
removeDetachedView(scrap, false);
return;
}