ARK-Builders / ARK-Navigator

Android app for navigation through your data
MIT License
15 stars 15 forks source link

Crash in gallery when loading an image #308

Open mdrlzy opened 2 years ago

mdrlzy commented 2 years ago

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)