Skip to content

Commit 047c22d

Browse files
committedAug 27, 2019
Fix cancelAll() termination condition
The method cancellAll() was using the field maxPreload to determine when the for loop should terminate, which was always off by one compared to the size of the preloadTargetQueue, and therefore, not all the pre-loaded requests would be canceled. This issue was raised in #3693
1 parent f36a9fa commit 047c22d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎library/src/main/java/com/bumptech/glide/ListPreloader.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ private void preloadItem(@Nullable T item, int position, int perItemPosition) {
219219
}
220220

221221
private void cancelAll() {
222-
for (int i = 0; i < maxPreload; i++) {
222+
for (int i = 0; i < preloadTargetQueue.queue.size(); i++) {
223223
requestManager.clear(preloadTargetQueue.next(0, 0));
224224
}
225225
}

0 commit comments

Comments
 (0)
Please sign in to comment.