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
Hi,
there is case regarding to ScopedFragment and "Kotlin android extensions" (old findViewById). In ScopedFragment, we cancel Job in onDestroy. AFAIK "Kotlin android extensions" assigns nulls to views in onDestroyView. So if there is coroutine running and trying to access a View after onDestroyView and before onDestroy, NullPointerException is thrown.
This can be difficult to see beforehand, maybe we should add warning at Readme file here?
The text was updated successfully, but these errors were encountered:
I can't think of one clean solution, depending on use case, maybe:
CoroutineScope can be created between onViewCreated()->onDestroyView() if coroutines change UI views
CoroutineScope can be created between onCreate() -> onDestroy() if coroutines does not touch the UI
Two CoroutineScopes in same Fragment for different purposes (mix of above two)
Another thing i stumbled upon is, there can be such flow in Fragment lifecycle:
onDestroyView()->onDetach()->onAttach()->onCreateView() onDestroy() and onCreate() is not called when fragment instance is alive, but view is destroyed and Fragment is detached.
Hi,
there is case regarding to ScopedFragment and "Kotlin android extensions" (old findViewById). In ScopedFragment, we cancel Job in onDestroy. AFAIK "Kotlin android extensions" assigns nulls to views in onDestroyView. So if there is coroutine running and trying to access a View after onDestroyView and before onDestroy, NullPointerException is thrown.
This can be difficult to see beforehand, maybe we should add warning at Readme file here?
The text was updated successfully, but these errors were encountered: