IllegalArgumentException: You cannot start a load for a destroyed activity
Mary-a67 opened this issue · comments
- Library Version: v2.1.12
- Affected Device: all
Describe the Bug:
I'm trying to upgrade from v2.1.11 to 12. but I see a crash time to time and some UI tests failed with this error
java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity at com.bumptech.glide.manager.RequestManagerRetriever.assertNotDestroyed(RequestManagerRetriever.java:366) at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:201) at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:136) at com.bumptech.glide.Glide.with(Glide.java:540) at com.skydoves.landscapist.glide.GlideImage__GlideImageKt$GlideImage$8.invoke(GlideImage.kt:285) at com.skydoves.landscapist.glide.GlideImage__GlideImageKt$GlideImage$8.invoke(GlideImage.kt:258) at com.skydoves.landscapist.ImageLoad__ImageLoadKt$ImageLoad$2$1$invoke$$inlined$onDispose$1.dispose(Effects.kt:485) at androidx.compose.runtime.DisposableEffectImpl.onForgotten(Effects.kt:85) at androidx.compose.runtime.CompositionImpl$RememberEventDispatcher.dispatchRememberObservers(Composition.kt:1094) at androidx.compose.runtime.CompositionImpl.dispose(Composition.kt:624) at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.disposeCurrentNodes(SubcomposeLayout.kt:712) at androidx.compose.ui.layout.SubcomposeLayoutState.disposeCurrentNodes$ui_release(SubcomposeLayout.kt:230) at androidx.compose.ui.layout.SubcomposeLayoutKt$SubcomposeLayout$5$1$invoke$$inlined$onDispose$1.dispose(Effects.kt:485) at androidx.compose.runtime.DisposableEffectImpl.onForgotten(Effects.kt:85) at androidx.compose.runtime.CompositionImpl$RememberEventDispatcher.dispatchRememberObservers(Composition.kt:1094) at androidx.compose.runtime.CompositionImpl.dispose(Composition.kt:624) at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.disposeCurrentNodes(SubcomposeLayout.kt:712) at androidx.compose.ui.layout.SubcomposeLayoutState.disposeCurrentNodes$ui_release(SubcomposeLayout.kt:230) at androidx.compose.ui.layout.SubcomposeLayoutKt$SubcomposeLayout$5$1$invoke$$inlined$onDispose$1.dispose(Effects.kt:485) at androidx.compose.runtime.DisposableEffectImpl.onForgotten(Effects.kt:85) at androidx.compose.runtime.CompositionImpl$RememberEventDispatcher.dispatchRememberObservers(Composition.kt:1094) at androidx.compose.runtime.CompositionImpl.dispose(Composition.kt:624) at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.disposeCurrentNodes(SubcomposeLayout.kt:712) at androidx.compose.ui.layout.SubcomposeLayoutState.disposeCurrentNodes$ui_release(SubcomposeLayout.kt:230) at androidx.compose.ui.layout.SubcomposeLayoutKt$SubcomposeLayout$5$1$invoke$$inlined$onDispose$1.dispose(Effects.kt:485) at androidx.compose.runtime.DisposableEffectImpl.onForgotten(Effects.kt:85) at androidx.compose.runtime.CompositionImpl$RememberEventDispatcher.dispatchRememberObservers(Composition.kt:1094) at androidx.compose.runtime.CompositionImpl.dispose(Composition.kt:624) at androidx.compose.ui.platform.WrappedComposition.dispose(Wrapper.android.kt:170) at androidx.compose.ui.platform.WrappedComposition.onStateChanged(Wrapper.android.kt:178) at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.kt:314) at androidx.lifecycle.LifecycleRegistry.backwardPass(LifecycleRegistry.kt:266) at androidx.lifecycle.LifecycleRegistry.sync(LifecycleRegistry.kt:283) at androidx.lifecycle.LifecycleRegistry.moveToState(LifecycleRegistry.kt:136) at androidx.lifecycle.LifecycleRegistry.handleLifecycleEvent(LifecycleRegistry.kt:119) at androidx.lifecycle.ReportFragment$Companion.dispatch$lifecycle_runtime_release(ReportFragment.kt:192) at androidx.lifecycle.ReportFragment.dispatch(ReportFragment.kt:87) at androidx.lifecycle.ReportFragment.onDestroy(ReportFragment.kt:77) at android.app.Fragment.performDestroy(Fragment.java:2782) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1451) at android.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1576) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1637) at android.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3046) at android.app.FragmentManagerImpl.dispatchDestroy(FragmentManager.java:3026) at android.app.FragmentController.dispatchDestroy(FragmentController.java:248) at android.app.Activity.performDestroy(Activity.java:7394) at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1306) at androidx.test.runner.MonitoringInstrumentation.callActivityOnDestroy(MonitoringInstrumentation.java:766) at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4443) at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4476) at android.app.servertransaction.DestroyActivityItem.execute(DestroyActivityItem.java:39) at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
I see this error related to glide but it refers to some internal class in landscapist.
at com.skydoves.landscapist.glide.GlideImage__GlideImageKt$GlideImage$8.invoke(GlideImage.kt:285)
I see it uses LocalContext.current, I tried to change the context but it happen again.
could you check if it's an internal error or not?
disposable = { Glide.with(context).clear(target) },
@Mary-a67 It has been fixed in the 2.1.13
. Thanks for reporting this issue!