You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. I found that in StackNavigationInstances of component are destroyed first, and then lifecycle of component is going pause-stop-destroy. I found that when implemented pause of video play on pause of component (which IMO is good as video is not playing in background) and also "releasing" (i.e. destroying with release of resources like threads etc) ExoPlayer in onDestroy method of Instance.
So, when I navigate back from screen with video I see this warning in logs:
Handler (android.os.Handler) {c3b8656} sending message to a Handler on a dead thread
java.lang.IllegalStateException: Handler (android.os.Handler) {c3b8656} sending message to a Handler on a dead thread
That is a clear signal that Instance::onDestroy is called first, and then Lifecycle.Callbacks::onPause is called (because stack trace leads to onPause).
I also found the source of this exception in Decompose code. Lines 189 and 190 are in wrong order and that is the problem. I think reproductions steps are not needed as the error is clear from code below:
Why this should not happen: because instances of classes should be destroyed only when there are no external links to them, i.e. noone can access already destroyed classes or releases resources. On android, ViewModel is destroyed later than Activity, for example.
Btw, I use 2.0.0-alpha-01 version, and tried with 2.0.0-alpha-02 - the error is still here. Artifacts used: decompose and extensions-compose-jetpack on Android 13 (Pixel Experience).
The text was updated successfully, but these errors were encountered:
HeroBrine1st
changed the title
[StackNavigation] Instances of component are destroyed earlier than component itself, leading to access of releases resources.
[StackNavigation] Instances of component are destroyed earlier than component itself, leading to access of released resources.
May 7, 2023
HeroBrine1st
changed the title
[StackNavigation] Instances of component are destroyed earlier than component itself, leading to access of released resources.
[StackNavigation] InstanceKeeper instances of component are destroyed earlier than component itself, leading to access to released resources.
May 7, 2023
Hello and thanks for reporting! Indeed it looks like a bug. I will investigate it further and provide updates here.
arkivanov
added
investigate
Something might be broken and needs to be investigated
bug
Something isn't working
and removed
investigate
Something might be broken and needs to be investigated
labels
May 7, 2023
Hello. I found that in
StackNavigation
Instance
s of component are destroyed first, and then lifecycle of component is going pause-stop-destroy. I found that when implemented pause of video play on pause of component (which IMO is good as video is not playing in background) and also "releasing" (i.e. destroying with release of resources like threads etc) ExoPlayer inonDestroy
method ofInstance
.So, when I navigate back from screen with video I see this warning in logs:
That is a clear signal that Instance::onDestroy is called first, and then Lifecycle.Callbacks::onPause is called (because stack trace leads to onPause).
I also found the source of this exception in Decompose code. Lines 189 and 190 are in wrong order and that is the problem. I think reproductions steps are not needed as the error is clear from code below:
Decompose/decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/children/ChildrenNavigator.kt
Lines 181 to 193 in 3fbf7c8
Why this should not happen: because instances of classes should be destroyed only when there are no external links to them, i.e. noone can access already destroyed classes or releases resources. On android, ViewModel is destroyed later than Activity, for example.
Btw, I use 2.0.0-alpha-01 version, and tried with 2.0.0-alpha-02 - the error is still here. Artifacts used:
decompose
andextensions-compose-jetpack
on Android 13 (Pixel Experience).The text was updated successfully, but these errors were encountered: