Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SelectionContainer occasionally crashes on iOS #4323

Closed
robxyy opened this issue Feb 17, 2024 · 3 comments
Closed

SelectionContainer occasionally crashes on iOS #4323

robxyy opened this issue Feb 17, 2024 · 3 comments
Assignees
Labels
bug Something isn't working crash ios reproduced

Comments

@robxyy
Copy link
Contributor

robxyy commented Feb 17, 2024

Describe the bug
SelectionContainer occasionally crashes on iOS

Affected platforms
Select one of the platforms below:

  • iOS

Versions

  • Kotlin version*: 1.9.22
  • Compose Multiplatform version*: 1.6.0-rc02

To Reproduce

  1. Long pressing SelectionContainer
  2. Scroll Text to Top.
Column(modifier.fillMaxSize().verticalScroll(rememberScrollState())) {
  SelectionContainer {
    Text(
      text = "Hello world!".repeat(500),
      modifier = Modifier.fillMaxWidth(),
    )
  }
}

Screenshots

Simulator.Screen.Recording.-.iPhone.SE.3rd.generation.-.2024-02-19.at.10.54.18.mp4
Stacktrace
Uncaught Kotlin exception: kotlin.IllegalStateException: Offset is unspecified
    at 0                               0x1011f470b        kfun:kotlin.Throwable#(kotlin.String?){} + 119 
    at 1                               0x1011edad3        kfun:kotlin.Exception#(kotlin.String?){} + 115 
    at 2                               0x1011edcf3        kfun:kotlin.RuntimeException#(kotlin.String?){} + 115 
    at 3                               0x1011ee31b        kfun:kotlin.IllegalStateException#(kotlin.String?){} + 115 
    at 4                               0x1017e48eb        kfun:androidx.compose.ui.geometry.Offset#(){}kotlin.Float + 327 
    at 5                               0x1024df9cf        kfun:androidx.compose.foundation.text.selection.object-2.calculatePosition#internal + 183 
    at 6                               0x102257a0f        kfun:androidx.compose.ui.window.PopupPositionProvider#calculatePosition(androidx.compose.ui.unit.IntRect;androidx.compose.ui.unit.IntSize;androidx.compose.ui.unit.LayoutDirection;androidx.compose.ui.unit.IntSize){}androidx.compose.ui.unit.IntOffset-trampoline + 123 
    at 7                               0x1021b63eb        kfun:androidx.compose.ui.window.rememberPopupMeasurePolicy$lambda$25$lambda$24#internal + 463 
    at 8                               0x1021b8833        kfun:androidx.compose.ui.window.$rememberPopupMeasurePolicy$lambda$25$lambda$24$FUNCTION_REFERENCE$23.invoke#internal + 111 
    at 9                               0x1021b8a3b        kfun:androidx.compose.ui.window.$rememberPopupMeasurePolicy$lambda$25$lambda$24$FUNCTION_REFERENCE$23.$invoke(androidx.compose.ui.unit.IntSize){}androidx.compose.ui.unit.IntOffset#internal + 123 
    at 10                              0x101319eb3        kfun:kotlin.Function1#invoke(1:0){}1:1-trampoline + 107 
    at 11                              0x1021b8f83        kfun:androidx.compose.ui.window#positionWithInsets__at__androidx.compose.ui.layout.MeasureScope(androidx.compose.ui.platform.PlatformInsets;androidx.compose.ui.unit.IntSize;kotlin.Function1){}androidx.compose.ui.unit.IntOffset + 547 
    at 12                              0x1021b66e7        kfun:androidx.compose.ui.window.rememberPopupMeasurePolicy$lambda$25#internal + 455 
    at 13                              0x1021b8223        kfun:androidx.compose.ui.window.$rememberPopupMeasurePolicy$lambda$25$FUNCTION_REFERENCE$20.invoke#internal + 147 
    at 14                              0x1021b844f        kfun:androidx.compose.ui.window.$rememberPopupMeasurePolicy$lambda$25$FUNCTION_REFERENCE$20.$invoke(androidx.compose.ui.layout.MeasureScope;androidx.compose.ui.unit.IntSize){}androidx.compose.ui.unit.IntOffset#internal + 159 
    at 15                              0x10131f083        kfun:kotlin.Function2#invoke(1:0;1:1){}1:2-trampoline + 115 
    at 16                              0x1021b9b87        kfun:androidx.compose.ui.window.RootMeasurePolicy$lambda$1#internal + 1471 
    at 17                              0x1021ba0ef        kfun:androidx.compose.ui.window.$RootMeasurePolicy$lambda$1$FUNCTION_REFERENCE$0.measure#internal + 231 
    at 18                              0x1021ba2cf        kfun:androidx.compose.ui.window.$RootMeasurePolicy$lambda$1$FUNCTION_REFERENCE$0.$measure@androidx.compose.ui.layout.MeasureScope(androidx.compose.ui.layout.MeasureScope;kotlin.collections.List){}androidx.compose.ui.layout.MeasureResult#internal + 239 
    at 19                              0x10224920b        kfun:androidx.compose.ui.layout.MeasurePolicy#measure__at__androidx.compose.ui.layout.MeasureScope(kotlin.collections.List;androidx.compose.ui.unit.Constraints){}androidx.compose.ui.layout.MeasureResult-trampoline + 123 
    at 20                              0x1020cc517        kfun:androidx.compose.ui.node.InnerNodeCoordinator#measure(androidx.compose.ui.unit.Constraints){}androidx.compose.ui.layout.Placeable + 875 
    at 21                              0x10225134b        kfun:androidx.compose.ui.node.NodeCoordinator#measure(androidx.compose.ui.unit.Constraints){}androidx.compose.ui.layout.Placeable-trampoline + 67 
    at 22                              0x102103c87        kfun:androidx.compose.ui.node.LayoutNodeLayoutDelegate.$lambda$0#internal + 175 
    at 23                              0x102103e13        kfun:androidx.compose.ui.node.LayoutNodeLayoutDelegate.$$lambda$0$FUNCTION_REFERENCE$0.invoke#internal + 71 
    at 24                              0x102103ee3        kfun:androidx.compose.ui.node.LayoutNodeLayoutDelegate.$$lambda$0$FUNCTION_REFERENCE$0.$invoke(){}#internal + 71 
    at 25                              0x10131b41b        kfun:kotlin.Function0#invoke(){}1:0-trampoline + 99 
    at 26                              0x10177dc37        kfun:androidx.compose.runtime.snapshots.Snapshot.Companion#observe(kotlin.Function1?;kotlin.Function1?;kotlin.Function0<0:0>){0§}0:0 + 943 
    at 27                              0x1017b244f        kfun:androidx.compose.runtime.snapshots.SnapshotStateObserver.ObservedScopeMap.observe#internal + 819 
    at 28                              0x1017af98b        kfun:androidx.compose.runtime.snapshots.SnapshotStateObserver#observeReads(0:0;kotlin.Function1<0:0,kotlin.Unit>;kotlin.Function0){0§} + 1363 
    at 29                              0x102136c0b        kfun:androidx.compose.ui.node.OwnerSnapshotObserver#observeReads(0:0;kotlin.Function1<0:0,kotlin.Unit>;kotlin.Function0){0§} + 227 
    at 30                              0x102136923        kfun:androidx.compose.ui.node.OwnerSnapshotObserver#observeMeasureSnapshotReads(androidx.compose.ui.node.LayoutNode;kotlin.Boolean;kotlin.Function0){} + 411 
    at 31                              0x102103033        kfun:androidx.compose.ui.node.LayoutNodeLayoutDelegate.performMeasure#internal + 679 
    at 32                              0x1020f6737        kfun:androidx.compose.ui.node.LayoutNodeLayoutDelegate.MeasurePassDelegate#remeasure(androidx.compose.ui.unit.Constraints){}kotlin.Boolean + 1131 
    at 33                              0x1020e4ec7        kfun:androidx.compose.ui.node.LayoutNode#remeasure(androidx.compose.ui.unit.Constraints?){}kotlin.Boolean + 315 
    at 34                              0x1020e5033        kfun:androidx.compose.ui.node.LayoutNode#remeasure$default(androidx.compose.ui.unit.Constraints?;kotlin.Int){}kotlin.Boolean + 275 
    at 35                              0x10210c7cf        kfun:androidx.compose.ui.node.MeasureAndLayoutDelegate.doRemeasure#internal + 283 
    at 36                              0x10210ea63        kfun:androidx.compose.ui.node.MeasureAndLayoutDelegate.remeasureAndRelayoutIfNeeded#internal + 1307 
    at 37                              0x10210f1a7        kfun:androidx.compose.ui.node.MeasureAndLayoutDelegate#remeasureAndRelayoutIfNeeded$default(androidx.compose.ui.node.LayoutNode;kotlin.Boolean;kotlin.Boolean;kotlin.Int){}kotlin.Boolean + 243 
    at 38                              0x10210cfb7        kfun:androidx.compose.ui.node.MeasureAndLayoutDelegate#measureAndLayout(kotlin.Function0?){}kotlin.Boolean + 1603 
    at 39                              0x102179a0b        kfun:androidx.compose.ui.node.RootNodeOwner.OwnerImpl.measureAndLayout#internal + 463 
    at 40                              0x102254dcf        kfun:androidx.compose.ui.node.Owner#measureAndLayout(kotlin.Boolean){}-trampoline + 103 
    at 41                              0x10217710f        kfun:androidx.compose.ui.node.RootNodeOwner#measureAndLayout(){} + 135 
    at 42                              0x1021a691b        kfun:androidx.compose.ui.scene.SingleLayerComposeSceneImpl.measureAndLayout#internal + 131 
    at 43                              0x10225c583        kfun:androidx.compose.ui.scene.BaseComposeScene#measureAndLayout(){}-trampoline + 51 
    at 44                              0x102192223        kfun:androidx.compose.ui.scene.BaseComposeScene.doLayout#internal + 147 
    at 45                              0x1021911f3        kfun:androidx.compose.ui.scene.BaseComposeScene#render(androidx.compose.ui.graphics.Canvas;kotlin.Long){} + 747 
    at 46                              0x1022580d7        kfun:androidx.compose.ui.scene.ComposeScene#render(androidx.compose.ui.graphics.Canvas;kotlin.Long){}-trampoline + 107 
    at 47                              0x1021e928b        kfun:androidx.compose.ui.scene.RenderingUIViewDelegateImpl.render#internal + 523 
    at 48                              0x1022627cf        kfun:androidx.compose.ui.window.RenderingUIView.Delegate#render(org.jetbrains.skia.Canvas;kotlin.Double){}-trampoline + 107 
    at 49                              0x102238e23        kfun:androidx.compose.ui.window.RenderingUIView.object-1.render#internal + 187 
    at 50                              0x1022623af        kfun:androidx.compose.ui.window.MetalRedrawerCallbacks#render(org.jetbrains.skia.Canvas;kotlin.Double){}-trampoline + 107 
    at 51                              0x102232177        kfun:androidx.compose.ui.window.MetalRedrawer.draw#internal + 2759 
    at 52                              0x10223316b        kfun:androidx.compose.ui.window.MetalRedrawer.$lambda$0#internal + 435 
    at 53                              0x1022342f7        kfun:androidx.compose.ui.window.MetalRedrawer.$$lambda$0$FUNCTION_REFERENCE$0.invoke#internal + 71 
    at 54                              0x1022343c7        kfun:androidx.compose.ui.window.MetalRedrawer.$$lambda$0$FUNCTION_REFERENCE$0.$invoke(){}#internal + 71 
    at 55                              0x10131b41b        kfun:kotlin.Function0#invoke(){}1:0-trampoline + 99 
    at 56                              0x10223510f        kfun:androidx.compose.ui.window.DisplayLinkProxy.handleDisplayLinkTick#internal + 151 
    at 57                              0x1022351c3        kfun:androidx.compose.ui.window.DisplayLinkProxy.$imp:handleDisplayLinkTick#internal + 143 
    at 58  QuartzCore                          0x189dc34ab        _ZN2CA7Display15DisplayLinkItem9dispatch_ERNS_8SignPost8IntervalILNS2_11CAEventCodeE835322056EEE + 43 
    at 59  QuartzCore                          0x189dc46d3        _ZN2CA7Display11DisplayLink14dispatch_itemsEyyy + 803 
    at 60  QuartzCore                          0x189dc429f        _ZN2CA7Display11DisplayLink8callbackEP15_CADisplayTimeryyybPv + 631 
    at 61  QuartzCore                          0x189ecab9b        _ZL22display_timer_callbackP12__CFMachPortPvlS1_ + 335 
    at 62  CoreFoundation                      0x1803b84e3        __CFMachPortPerform + 171 
    at 63  CoreFoundation                      0x1803eeddb        __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 55 
    at 64  CoreFoundation                      0x1803ee3ab        __CFRunLoopDoSource1 + 495 
    at 65  CoreFoundation                      0x1803e89bb        __CFRunLoopRun + 2175 
    at 66  CoreFoundation                      0x1803e7d27        CFRunLoopRunSpecific + 571 
    at 67  GraphicsServices                    0x18e7cdbbf        GSEventRunModal + 159 
    at 68  UIKitCore                           0x1852bafdb        -[UIApplication _run] + 867 
    at 69  UIKitCore                           0x1852bec53        UIApplicationMain + 123 
    at 70  SwiftUI                             0x1c4b04523        OUTLINED_FUNCTION_70 + 499 
    at 71  SwiftUI                             0x1c4b043c3        OUTLINED_FUNCTION_70 + 147 
    at 72  SwiftUI                             0x1c4816107        OUTLINED_FUNCTION_2 + 91 
    at 73                              0x100d571c7        $s8App_Dev0A3AppV5$mainyyFZ + 39 
    at 74                              0x100d57277        main + 11 (/App.swift:)
    at 75  dyld                                0x105435557        0x0 + 4383266135 
    at 76  ???                                 0x1055d6057        0x0 + 4384972887 
    at 77  ???                                 0x3e3affffffffffff 0x0 + 4484177853977460735 
@robxyy robxyy added bug Something isn't working submitted labels Feb 17, 2024
@dima-avdeev-jb
Copy link
Contributor

@robxyy can you please create a minimal reproducible sample?

@robxyy
Copy link
Contributor Author

robxyy commented Feb 19, 2024

@robxyy can you please create a minimal reproducible sample?

@dima-avdeev-jb To Reproduce and Screenshots has been updated.

@dima-avdeev-jb dima-avdeev-jb self-assigned this Feb 19, 2024
MatkovIvan added a commit to JetBrains/compose-multiplatform-core that referenced this issue Feb 19, 2024
## Proposed Changes

- Update code in iOS SelectionHandles position calculation like in
Android was.

## Testing

Run by hands sample in DemoApp / Components / Selection / 

## Issues Fixed

 - JetBrains/compose-multiplatform#4323

---------

Co-authored-by: Ivan Matkov <ivan.matkov@jetbrains.com>
igordmn pushed a commit to JetBrains/compose-multiplatform-core that referenced this issue Feb 19, 2024
## Proposed Changes

- Update code in iOS SelectionHandles position calculation like in
Android was.

## Testing

Run by hands sample in DemoApp / Components / Selection /

## Issues Fixed

 - JetBrains/compose-multiplatform#4323

---------

Co-authored-by: Ivan Matkov <ivan.matkov@jetbrains.com>
# Conflicts:
#	compose/mpp/demo/src/commonMain/kotlin/androidx/compose/mpp/demo/components/Selection.kt
@dima-avdeev-jb
Copy link
Contributor

Will be fixed in 1.6.0-rc03

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working crash ios reproduced
Projects
None yet
Development

No branches or pull requests

2 participants