Assigned
Status Update
Comments
ma...@google.com <ma...@google.com>
ap...@google.com <ap...@google.com> #2
Fatal Exception: java.lang.IllegalArgumentException: offset(9) is out of bounds [0, 8]
at androidx.compose.ui.text.MultiParagraph.requireIndexInRangeInclusiveEnd(MultiParagraph.kt:593)
at androidx.compose.ui.text.MultiParagraph.getCursorRect(MultiParagraph.java:442)
at androidx.compose.ui.text.TextLayoutResult.getCursorRect(TextLayoutResult.kt:390)
at androidx.compose.foundation.text.TextFieldScrollKt.getCursorRectInScroller(TextFieldScrollKt.java:207)
at androidx.compose.foundation.text.TextFieldScrollKt.access$getCursorRectInScroller(TextFieldScrollKt.java:1)
at androidx.compose.foundation.text.HorizontalScrollLayoutModifier$measure$1.invoke(TextFieldScroll.kt:179)
at androidx.compose.foundation.text.HorizontalScrollLayoutModifier$measure$1.invoke$bridge(TextFieldScroll.kt:12)
at androidx.compose.foundation.text.HorizontalScrollLayoutModifier$measure$1.invoke(TextFieldScroll.kt:178)
at androidx.compose.foundation.text.HorizontalScrollLayoutModifier$measure$1.invoke$bridge(TextFieldScroll.kt:27)
at androidx.compose.ui.layout.MeasureScope$layout$1.placeChildren(MeasureScope.kt:68)
ma...@google.com <ma...@google.com> #3
It's hard to tackle the issue without a repro, I couldn't reproduce the crash using Compose's demo app.
It would help if you provide a repro, or at least a code of how the text field is used in your app.
Description
If the result of the factory function will compare equals with the result of a second invocation with the exact same parameters, then the function can be marked as @Stable. All of our modifier factories should meet this requirement (however there are some that don't still).
Marking them this way can reduce composition overhead in many common cases and is an easy win.
More context on this issue can be found in aosp/2729638