ARK-Builders / ARK-Builders/Navigator

Crash in gallery when loading an image

Open
#308 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Kotlin
Stars
16
Forks
14
PR merge metrics
No merged PRs in 30d

Description

The crash occurred when returning from the background and it looks like the screen was rotated
To fix this we need to change the `presenterScope` to `lifecycleScope` when loading the image

```
08-27 19:48:07.194 E/ACRA (13528): java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity
08-27 19:48:07.194 E/ACRA (13528): at com.bumptech.glide.manager.RequestManagerRetriever.assertNotDestroyed(RequestManagerRetriever.java:353)
08-27 19:48:07.194 E/ACRA (13528): at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:153)
08-27 19:48:07.194 E/ACRA (13528): at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:133)
08-27 19:48:07.194 E/ACRA (13528): at com.bumptech.glide.Glide.with(Glide.java:818)
08-27 19:48:07.194 E/ACRA (13528): at space.taran.arknavigator.utils.ImageUtils.loadGlideZoomImage(ImageUtils.kt:47)
08-27 19:48:07.194 E/ACRA (13528): at space.taran.arknavigator.ui.adapter.previewpager.PreviewItemViewHolder.loadImage(PreviewItemViewHolder.kt:82)
08-27 19:48:07.194 E/ACRA (13528): at space.taran.arknavigator.ui.adapter.previewpager.PreviewItemViewHolder.setSource(PreviewItemViewHolder.kt:60)
08-27 19:48:07.194 E/ACRA (13528): at space.taran.arknavigator.mvp.presenter.GalleryPresenter$bindView$1.invokeSuspend(GalleryPresenter.kt:120)
08-27 19:48:07.194 E/ACRA (13528): at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
08-27 19:48:07.194 E/ACRA (13528): at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
08-27 19:48:07.194 E/ACRA (13528): at android.os.Handler.handleCallback(Handler.java:891)
08-27 19:48:07.194 E/ACRA (13528): at android.os.Handler.dispatchMessage(Handler.java:102)
08-27 19:48:07.194 E/ACRA (13528): at android.os.Looper.loop(Looper.java:207)
08-27 19:48:07.194 E/ACRA (13528): at android.app.ActivityThread.main(ActivityThread.java:7539)
08-27 19:48:07.194 E/ACRA (13528): at java.lang.reflect.Method.invoke(Native Method)
08-27 19:48:07.194 E/ACRA (13528): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
08-27 19:48:07.194 E/ACRA (13528): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)
```

Contributor guide

Open the contributing guide

Research direction

Start in mvp/presenter/GalleryPresenter.kt at bindView and compare the presenterScope used around image loading with the lifecycleScope requested by the issue. Trace the call into PreviewItemViewHolder.kt and ImageUtils.kt, then verify that returning from the background after rotation no longer starts a Glide load for a destroyed activity.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.