Skip to content

Commit

Permalink
Avoid holding a lock while calling other RequestManagers in clear().
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 260756583
  • Loading branch information
sjudd authored and glide-copybara-robot committed Jul 30, 2019
1 parent 0ac450c commit 6dc03d8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions library/src/main/java/com/bumptech/glide/RequestManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ public void clear(@NonNull View view) {
*
* @param target The Target to cancel loads for.
*/
public synchronized void clear(@Nullable final Target<?> target) {
public void clear(@Nullable final Target<?> target) {
if (target == null) {
return;
}
Expand All @@ -617,8 +617,8 @@ private void untrackOrDelegate(@NonNull Target<?> target) {
// the corresponding Activity or Fragment is destroyed because retaining any reference to the
// RequestManager leaks memory. It's possible that there's some brief period of time during or
// immediately after onDestroy where this is reasonable, but I can't think of why.
if (!isOwnedByUs && !glide.removeFromManagers(target) && target.getRequest() != null) {
Request request = target.getRequest();
Request request = target.getRequest();
if (!isOwnedByUs && !glide.removeFromManagers(target) && request != null) {
target.setRequest(null);
request.clear();
}
Expand Down

0 comments on commit 6dc03d8

Please sign in to comment.