JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.94k stars 1.16k forks source link

Exception in TextField - dispatch key event - cant be negative at end #2269

Open ghost opened 2 years ago

ghost commented 2 years ago

I uploaded my app to play store but I got this crash in pre-launch report regarding a text field. I am not able to find the root cause for this. Why is this happening? Here is the stack trace Fatal Exception: java.lang.IllegalArgumentException: end cannot negative. [end: -1] at androidx.compose.ui.text.TextRangeKt.packWithCheck(TextRangeKt.java:1) at androidx.compose.ui.text.input.EditingBuffer.delete$ui_text_release(EditingBuffer.java) at androidx.compose.ui.text.input.DeleteSurroundingTextCommand.applyTo(DeleteSurroundingTextCommand.java:2) at androidx.compose.ui.text.input.EditProcessor.apply(EditProcessor.java:2) at androidx.compose.foundation.text.TextFieldKeyInput.apply(TextFieldKeyInput.java:2) at androidx.compose.foundation.text.TextFieldKeyInput.access$apply(TextFieldKeyInput.java:59) at androidx.compose.foundation.text.TextFieldKeyInput$process$2.invoke(TextFieldKeyInput.java:59) at androidx.compose.foundation.text.TextFieldKeyInput$process$2.invoke(TextFieldKeyInput.java:59) at androidx.compose.foundation.text.TextFieldKeyInput.commandExecutionContext(TextFieldKeyInput.java:14) at androidx.compose.foundation.text.TextFieldKeyInputKt$textFieldKeyInput$2$1.invoke-ZmokQxo(TextFieldKeyInputKt.java:14) at androidx.compose.foundation.text.TextFieldKeyInputKt$textFieldKeyInput$2$1.invoke(TextFieldKeyInputKt.java:14) at androidx.compose.ui.node.ModifiedKeyInputNode.propagateKeyEvent-ZmokQxo(ModifiedKeyInputNode.java:5) at androidx.compose.ui.input.key.KeyInputModifier.processKeyInput-ZmokQxo(KeyInputModifier.java:9) at androidx.compose.ui.platform.AndroidComposeView.sendKeyEvent-ZmokQxo(AndroidComposeView.java:9) at androidx.compose.ui.platform.AndroidComposeView.dispatchKeyEvent(AndroidComposeView.java:9) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1840) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1840) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1840) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1840) at com.android.internal.policy.DecorView.superDispatchKeyEvent(DecorView.java:444) at com.android.internal.policy.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1819) at androidx.core.view.KeyEventDispatcher.activitySuperDispatchKeyEventPre28(KeyEventDispatcher.java:3) at androidx.core.app.ComponentActivity.dispatchKeyEvent(ComponentActivity.java:18) at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:358) at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:4979) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4851) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4385) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4438) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4404) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4531) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4412) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4588) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4385) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4438) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4404) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4412) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4385) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4438) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4404) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4564) at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:4733) at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:2430) at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:1993) at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:1984) at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:2407) at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:141) at android.os.MessageQueue.nativePollOnce(MessageQueue.java) at android.os.MessageQueue.next(MessageQueue.java:331) at android.os.Looper.loop(Looper.java:149) at android.app.ActivityThread.main(ActivityThread.java:6662) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)

okushnikov commented 3 weeks ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

okushnikov commented 3 weeks ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.