Skip to content

Commit 6dc03d8

Browse files
sjuddglide-copybara-robot
authored andcommittedJul 30, 2019
Avoid holding a lock while calling other RequestManagers in clear().
PiperOrigin-RevId: 260756583
1 parent 0ac450c commit 6dc03d8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ public void clear(@NonNull View view) {
590590
*
591591
* @param target The Target to cancel loads for.
592592
*/
593-
public synchronized void clear(@Nullable final Target<?> target) {
593+
public void clear(@Nullable final Target<?> target) {
594594
if (target == null) {
595595
return;
596596
}
@@ -617,8 +617,8 @@ private void untrackOrDelegate(@NonNull Target<?> target) {
617617
// the corresponding Activity or Fragment is destroyed because retaining any reference to the
618618
// RequestManager leaks memory. It's possible that there's some brief period of time during or
619619
// immediately after onDestroy where this is reasonable, but I can't think of why.
620-
if (!isOwnedByUs && !glide.removeFromManagers(target) && target.getRequest() != null) {
621-
Request request = target.getRequest();
620+
Request request = target.getRequest();
621+
if (!isOwnedByUs && !glide.removeFromManagers(target) && request != null) {
622622
target.setRequest(null);
623623
request.clear();
624624
}

0 commit comments

Comments
 (0)
Please sign in to comment.