bumptech / bumptech/glide

RequestManager in paused state when fragment is recreated and Glide.with(fragment) is called onAttach

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

Description

When Glide is initialized on `onAttach` fragment callback during app recreating flow (Fragment automatically recreated by FragmentManager), the `RequestManager` stays in `paused` state forever.

Notice we initialize Glide in Dagger, that's why it gets initialized on `onAttach`. But we have been able to reproduce on a simple app initializing directly on `onAttach`.
Using a `Lazy` dagger creation solves the issue for now.

Steps to follow:
1. Launch the app and fragment is created and images are loading.
2. Press Home to put the app in background.
3. Kill the App through Android Studio "Terminate Application" button.
4. Reopen the app from recents.

**Glide Version**: 4.12.0
**Device/Android Version**: All

**Issue details / Repro steps / Use case background**:

**Glide load line / `GlideModule` (if any) / list Adapter code (if any)**:
```java
override fun onAttach(context: Context) {
super.onAttach(context)

glide = Glide.with(this)
}
```

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.