Load same url into same ImageView,the second load will notify first RequestListener.
- Dominant language
- Java
- Stars
- 35k
- Forks
- 6.2k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 8
Description
**Glide Version**: 4.12.0
**Issue details / Repro steps / Use case background**:
Load same url into same ImageView,the second load will notify first RequestListener.
**Glide load line / `GlideModule` (if any) / list Adapter code (if any)**:
```java
private RequestListener mListener;
private void testLoad() {
RequestListener listener = new RequestListener() {
@Override
public boolean onResourceReady(Drawable resource, Object model, Target target, DataSource dataSource, boolean isFirstResource) {
Log.e("TEST", "onResourceReady: " + mListener + " | " + this);
if (mListener == this) {
new Handler(Looper.getMainLooper()).postDelayed(() -> testLoad(), 1000);
} else {
Log.e("TEST", "onResourceReady error");
}
return false;
}
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target target, boolean isFirstResource) {
return false;
}
};
mListener = listener;
Log.e("TEST", "startLoad: " + listener);
Glide.with(this)
.load("https://www.baidu.com/img/flexible/logo/pc/result.png")
.listener(listener)
.into(testIV);
}
```
**Stack trace / LogCat**:
```ruby
2021-05-22 17:30:19.665 7783-7783/*** E/TEST: startLoad: ***.MainActivity$4@ef3e871
2021-05-22 17:30:20.705 7783-7783/*** E/TEST: onResourceReady: ***.MainActivity$4@ef3e871 | ***.MainActivity$4@ef3e871
2021-05-22 17:30:21.712 7783-7783/*** E/TEST: startLoad: ***.MainActivity$4@59d9769
2021-05-22 17:30:21.715 7783-7783/*** E/TEST: onResourceReady: ***.MainActivity$4@59d9769 | ***.MainActivity$4@ef3e871
2021-05-22 17:30:21.715 7783-7783/*** E/TEST: onResourceReady error
```
**In the second load task, glide will call the first RequestListener!!!**
Contributor guide
Research direction
The payload provides only the testLoad() reproduction and the testIV ImageView, with no source file or test name. Start by reproducing the repeated same-URL load and trace request-listener callbacks. Done means the second load no longer invokes the first RequestListener, with regression coverage for this sequence.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100