Fixed
Status Update
Comments
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #2
Hi Ed, Thank you so much for these suggestions. I've been reviewing them and merging them in. Hopefully it should be live. I've included a thank you note too in the article.
il...@google.com <il...@google.com> #3
Great! Thanks a lot, I'll look for the live updates soon!
Description
Version used: 1.0.0-alpha07
Calling `OnBackPressedCallback.remove()` during `handleOnBackPressed()` on a callback attached to a `LifecycleOwner` causes a `ConcurrentModificationException`:
java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.next(ArrayList.java:860)
at androidx.activity.OnBackPressedCallback.remove(OnBackPressedCallback.java:92)
at androidx.activity.OnBackPressedHandlerTest$testLifecycleRemoveInCallback$onBackPressedCallback$1.handleOnBackPressed(OnBackPressedDispatcherTest.kt:283)
at androidx.activity.OnBackPressedDispatcher.onBackPressed(OnBackPressedDispatcher.java:189)
at androidx.activity.OnBackPressedHandlerTest.testLifecycleRemoveInCallback(OnBackPressedDispatcherTest.kt:297)
at java.lang.reflect.Method.invoke(Native Method)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at androidx.test.internal.runner.junit4.statement.UiThreadStatement$1.run(UiThreadStatement.java:55)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.app.Instrumentation$SyncRunnable.run(Instrumentation.java:2093)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)