bumptech / bumptech/glide

Glide clear called while activity is destroyed

Open
#4,586 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
35k
Forks
6.2k
Avg merge
1d 11h
Merged PRs (30d)
8

Description

**Glide Version**: 4.12.0

**Integration libraries**:

**Device/Android Version**: Galaxy A70 Android 9

**Issue details / Repro steps / Use case background**:
Firebase client crash:
```
Caused by java.lang.IllegalArgumentException
You cannot start a load for a destroyed activity
```
It looks like in some rare cases (I saw this error only once), the activity is destroyed just before the view is recycled. As we try to clear the load on recycling, we got this crash.
- Should we use the application context to clear the load?
- Could it be a [FastAdapter](https://github.com/mikepenz/FastAdapter) error (unexpected call to `unbindView` with a destroyed activity)
- Is there another way to avoid the crash (We don't care about the clear if our single activity is being destroy...)

**Glide load line / `GlideModule` (if any) / list Adapter code (if any)**:
We are using [FastAdapter](https://github.com/mikepenz/FastAdapter)
```kotlin
override fun unbindView(binding: MediaItemBinding) {
super.unbindView(binding)
GlideApp.with(binding.mediaThumbnailImageView).clear(binding.mediaThumbnailImageView) // crash
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.