theapache64
03/30/2022, 5:57 PMlayoutCoordinates.positionInRoot()
. This is only happening in release build.
Fatal Exception: java.lang.IllegalStateException
LayoutCoordinate operations are only valid when isAttached is true
theapache64
03/30/2022, 6:06 PM1.1.0-rc01
I can wrap it inside a if(layoutCoordinates.isAttached)
but am thinking why this is happening only on release build? 🤔Doris Liu
03/31/2022, 7:14 PMtheapache64
03/31/2022, 7:15 PMtheapache64
03/31/2022, 7:15 PMtheapache64
03/31/2022, 7:15 PMDoris Liu
03/31/2022, 7:20 PMtheapache64
03/31/2022, 7:22 PMandroidx.compose.ui.node.LayoutNodeWrapper.localToRoot-MK-Hz9U (LayoutNodeWrapper.kt:767)
androidx.compose.ui.layout.LayoutCoordinatesKt.positionInRoot (LayoutCoordinatesKt.java:103)
com.my.company.TrackModifierKt$track$1$2$1.invokeSuspend (TrackModifier.kt:104)
kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33)
kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:106)
androidx.compose.ui.platform.AndroidUiDispatcher.performTrampolineDispatch (AndroidUiDispatcher.android.kt:81)
androidx.compose.ui.platform.AndroidUiDispatcher.access$performTrampolineDispatch (AndroidUiDispatcher.android.kt:41)
androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.run (AndroidUiDispatcher.android.kt:57)
android.os.Handler.handleCallback (Handler.java:938)
android.os.Handler.dispatchMessage (Handler.java:99)
android.os.Looper.loop (Looper.java:246)
android.app.ActivityThread.main (ActivityThread.java:8633)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:602)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1130)
theapache64
03/31/2022, 7:25 PMTrackModifier.kt:104
has a positionInRoot()
call inside a onGloballyPositioned
modifierDoris Liu
03/31/2022, 7:29 PMonGloballyPositioned
callback, or did you cache the layoutCoordinates and used it at a different time?theapache64
03/31/2022, 7:32 PMtheapache64
03/31/2022, 7:33 PMDoris Liu
03/31/2022, 7:33 PMpositionInRoot
only guarantees correctness if you query it after the layout pass is done.theapache64
03/31/2022, 7:34 PMisAttached
flag before accessing positionInRoot
? would that help me with the crash. ?Doris Liu
03/31/2022, 7:35 PMtheapache64
03/31/2022, 7:35 PM