compose-multiplatform: 1.5.10-rc01 crash on iOS with custom font

Describe the bug 1.5.10-rc01 throws NSInvalidArgumentException when navigating back.

Affected platforms

  • iOS

Versions

  • Kotlin version: 1.9.20-Beta2
  • Compose Multiplatform version: 1.5.10-rc01 (compiler: 1.5.2.1-Beta3)
  • OS version(s) (required for Desktop and iOS issues): iOS 17.0
  • OS architecture (x86 or arm64): arm64

To Reproduce

  1. Checkout https://github.com/GuilhE/Expressus
  2. Update gradleComposeMultiplatform in libs.versions.toml to 1.5.10-rc01
  3. Run iOS
  4. Press SWIFT_UI or COMPOSE and then the back button

Android Studio / Xcode /Xcode Preview, all will fail.

Expected behavior Not crashing

Video

https://github.com/JetBrains/compose-multiplatform/assets/2677139/ef65be70-8ac1-4424-8584-5487413021dd

Additional context Could it be an ABI error like explained here (time 26:00)?

.../Expressus/build/ios/Debug-iphonesimulator/iosApp.app
Class SkikoUIView has multiple implementations. Which one will be used is undefined.
WARNING: `Info.plist` doesn't have a valid `CADisableMinimumFrameDurationOnPhone` entry. Framerate will be restricted to 60hz on iPhones. To support high frequency rendering on iPhones, add `<key>CADisableMinimumFrameDurationOnPhone</key><true/>` entry to `Info.plist`.
2023-10-14 02:06:58.427348+0100 iosApp[35996:878310] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSMutableDictionary __addObject:forKey:]: object cannot be nil'
*** First throw call stack:
(
	0   CoreFoundation                      0x00000001804658a8 __exceptionPreprocess + 172
	1   libobjc.A.dylib                     0x000000018005c09c objc_exception_throw + 56
	2   CoreFoundation                      0x00000001803cf738 -[NSMutableDictionary __addObject:forKey:] + 532
	3   SharedComposables                   0x0000000108ba3e84 _ZN13SkFontMgr_Mac9CreateSetEPK10__CFString + 80
	4   SharedComposables                   0x0000000108ba2d2c _ZNK13SkFontMgr_Mac13onMatchFamilyEPKc + 40
	5   SharedComposables                   0x00000001089ff4d4 _ZNK9SkFontMgr11matchFamilyEPKc + 20
	6   SharedComposables                   0x000000010899ff44 _ZN4skia10textlayout14FontCollection13matchTypefaceERK8SkString11SkFontStyle + 184
	7   SharedComposables                   0x000000010899f9fc _ZN4skia10textlayout14FontCollection13find
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSMutableDictionary __addObject:forKey:]: object cannot be nil'
*** First throw call stack:
(
	0   CoreFoundation                      0x00000001804658a8 __exceptionPreprocess + 172
	1   libobjc.A.dylib                     0x000000018005c09c objc_exception_throw + 56
	2   CoreFoundation                      0x00000001803cf738 -[NSMutableDictionary __addObject:forKey:] + 532
	3   SharedComposables                   0x0000000108ba3e84 _ZN13SkFontMgr_Mac9CreateSetEPK10__CFString + 80
	4   SharedComposables                   0x0000000108ba2d2c _ZNK13SkFontMgr_Mac13onMatchFamilyEPKc + 40
	5   SharedComposables                   0x00000001089ff4d4 _ZNK9SkFontMgr11matchFamilyEPKc + 20
	6   SharedComposables                   0x000000010899ff44 _ZN4skia10textlayout14FontCollection13matchTypefaceERK8SkString11SkFontStyle + 184
	7   SharedComposables                   0x000000010899f9fc _ZN4skia10textlayout14FontCollection13findTypefacesERKNSt3__16vectorI8SkStringNS2_9allocatorIS4_EEEE11SkFontStyleRKNS2_8optionalINS0_13FontArgumentsEEE + 400
	8   SharedComposables                   0x00000001089af2fc _ZN4skia10textlayout13ParagraphImpl19computeEmptyMetricsEv + 144
	9   SharedComposables                   0x00000001089aea9c _ZN4skia10textlayout13ParagraphImpl6layoutEf + 696
	10  SharedComposables                   0x0000000108958b04 kfun:org.jetbrains.skia.paragraph.Paragraph#layout(kotlin.Float){}org.jetbrains.skia.paragraph.Paragraph + 176
	11  SharedComposables                   0x000000010944bc1c kfun:androidx.compose.ui.text.platform.ParagraphLayouter#layoutParagraph(kotlin.Float){}org.jetbrains.skia.paragraph.Paragraph + 488
	12  SharedComposables                   0x0000000109460140 kfun:androidx.compose.ui.text.platform.SkiaParagraphIntrinsics#<init>(kotlin.String;androidx.compose.ui.text.TextStyle;kotlin.collections.List<androidx.compose.ui.text.AnnotatedString.Range<andro	13  SharedComposables                   0x000000010945fdf8 kfun:androidx.compose.ui.text.platform#ActualParagraphIntrinsics(kotlin.String;androidx.compose.ui.text.TextStyle;kotlin.collections.List<androidx.compose.ui.text.AnnotatedString.Range<androidx.c	14  SharedComposables                   0x00000001093db194 kfun:androidx.compose.ui.text#ParagraphIntrinsics(kotlin.String;androidx.compose.ui.text.TextStyle;kotlin.collections.List<androidx.compose.ui.text.AnnotatedString.Range<androidx.compose.ui.text.	15  SharedComposables                   0x00000001093db3a4 kfun:androidx.compose.ui.text#ParagraphIntrinsics$default(kotlin.String;androidx.compose.ui.text.TextStyle;kotlin.collections.List<androidx.compose.ui.text.AnnotatedString.Range<androidx.compose.	16  SharedComposables                   0x0000000109740eb4 kfun:androidx.compose.foundation.text.modifiers.ParagraphLayoutCache.setLayoutDirection#internal + 680
	17  SharedComposables                   0x0000000109741000 kfun:androidx.compose.foundation.text.modifiers.ParagraphLayoutCache.layoutText#internal + 192
	18  SharedComposables                   0x000000010974068c kfun:androidx.compose.foundation.text.modifiers.ParagraphLayoutCache#layoutWithConstraints(androidx.compose.ui.unit.Constraints;androidx.compose.ui.unit.LayoutDirection){}kotlin.Boolean + 1400
	19  SharedComposables                   0x000000010975239c kfun:androidx.compose.foundation.text.modifiers.TextStringSimpleNode#measure__at__androidx.compose.ui.layout.MeasureScope(androidx.compose.ui.layout.Measurable;androidx.compose.ui.unit.Constraint	20  SharedComposables                   0x000000010961ba84 kfun:androidx.compose.ui.node.LayoutModifierNode#measure__at__androidx.compose.ui.layout.MeasureScope(androidx.compose.ui.layout.Measurable;androidx.compose.ui.unit.Constraints){}androidx.compose	21  SharedComposables                   0x00000001095176cc kfun:androidx.compose.ui.node.LayoutModifierNodeCoordinator#measure(androidx.compose.ui.unit.Constraints){}androidx.compose.ui.layout.Placeable + 932
	22  SharedComposables                   0x000000010960b554 kfun:androidx.compose.ui.layout.Measurable#measure(androidx.compose.ui.unit.Constraints){}androidx.compose.ui.layout.Placeable-trampoline + 108
	23  SharedComposables                   0x00000001094ab45c kfun:androidx.compose.ui.graphics.SimpleGraphicsLayerModifier.measure#internal + 204
	24  SharedComposables                   0x000000010961ba84 kfun:androidx.compose.ui.node.LayoutModifierNode#measure__at__androidx.compose.ui.layout.MeasureScope(androidx.compose.ui.layout.Measurable;androidx.compose.ui.unit.Constraints){}androidx.compose	25  SharedComposables                   0x00000001095176cc kfun:androidx.compose.ui.node.LayoutModifierNodeCoordinator#measure(androidx.compose.ui.unit.Constraints){}androidx.compose.ui.layout.Placeable + 932
	26  SharedComposables                   0x000000010960b554 kfun:androidx.compose.ui.layout.Measurable#measure(androidx.compose.ui.unit.Constraints){}androidx.compose.ui.layout.Placeable-trampoline + 108
	27  SharedComposables                   0x0000000109642ee8 kfun:androidx.compose.foundation.layout.PaddingNode.measure#internal + 488
	28  SharedComposables                   0x000000010961ba84 kfun:androidx.compose.ui.node.LayoutModifierNode#measure__at__androidx.compose.ui.layout.MeasureScope(androidx.compose.ui.layout.Measurable;androidx.compose.ui.unit.Constraints){}androidx.compose	29  SharedComposables                   0x00000001095176cc kfun:androidx.compose.ui.node.LayoutModifierNodeCoordinator#measure(androidx.compose.ui.unit.Constraints){}androidx.compose.ui.layout.Placeable + 932
	30  SharedComposables                   0x000000010960b554 kfun:androidx.compose.ui.layout.Measurable#measure(androidx.compose.ui.unit.Constraints){}androidx.compose.ui.layout.Placeable-trampoline + 108
	31  SharedComposables                   0x00000001096587f4 kfun:androidx.compose.foundation.layout.FillNode.measure#internal + 1004
	32  SharedComposables                   0x000000010961ba84 kfun:androidx.compose.ui.node.LayoutModifierNode#measure__at__androidx.compose.ui.layout.MeasureScope(androidx.compose.ui.layout.Measurable;androidx.compose.ui.unit.Constraints){}androidx.compose	33  SharedComposables                   0x00000001095176cc kfun:androidx.compose.ui.node.LayoutModifierNodeCoordinator#measure(androidx.compose.ui.unit.Constraints){}androidx.compose.ui.layout.Placeable + 932
	34  SharedComposables                   0x000000010961e170 kfun:androidx.compose.ui.node.NodeCoordinator#measure(androidx.compose.ui.unit.Constraints){}androidx.compose.ui.layout.Placeable-trampoline + 68
	35  SharedComposables                   0x0000000109545e8c kfun:androidx.compose.ui.node.LayoutNodeLayoutDelegate.performMeasure$lambda$0#internal + 168
	36  SharedComposables                   0x000000010954601c kfun:androidx.compose.ui.node.LayoutNodeLayoutDelegate.$performMeasure$lambda$0$FUNCTION_REFERENCE$10.invoke#internal + 76
	37  SharedComposables                   0x0000000109546108 kfun:androidx.compose.ui.node.LayoutNodeLayoutDelegate.$performMeasure$lambda$0$FUNCTION_REFERENCE$10.$<bridge-UNN>invoke(){}#internal + 72
	38  SharedComposables                   0x00000001091306b4 kfun:kotlin.Function0#invoke(){}1:0-trampoline + 100
	39  SharedComposables                   0x00000001093103c0 kfun:androidx.compose.runtime.snapshots.Snapshot.Companion#observe(kotlin.Function1<kotlin.Any,kotlin.Unit>?;kotlin.Function1<kotlin.Any,kotlin.Unit>?;kotlin.Function0<0:0>){0§<kotlin.Any?>}0:0 	40  SharedComposables                   0x00000001093439a0 kfun:androidx.compose.runtime.snapshots.SnapshotStateObserver.ObservedScopeMap.observe#internal + 820
	41  SharedComposables                   0x00000001093414b0 kfun:androidx.compose.runtime.snapshots.SnapshotStateObserver#observeReads(0:0;kotlin.Function1<0:0,kotlin.Unit>;kotlin.Function0<kotlin.Unit>){0§<kotlin.Any>} + 680
	42  SharedComposables                   0x0000000109577650 kfun:androidx.compose.ui.node.OwnerSnapshotObserver#observeReads(0:0;kotlin.Function1<0:0,kotlin.Unit>;kotlin.Function0<kotlin.Unit>){0§<androidx.compose.ui.nod
libc++abi: terminating due to uncaught exception of type NSException

Process finished with exit code 0

Note, with:

  • Kotlin version: 1.9.20-RC
  • Compose Multiplatform version: 1.5.10-rc01 (compiler: 1.5.2.1-rc01)

It will randomly crash with the same stack-trace.

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Reactions: 1
  • Comments: 20 (14 by maintainers)

Most upvoted comments

tested with ComposeMultiplatform = 1.5.11 and could not reproduce 😉

@aligkts We are contune researching this bug. I hope to fix it in neareset future.

We fixed this problem in version 0.7.88 of Skiko library. We plan to release Compose with this fix later. But, for now you can do the following: in build.gradle.kts module with Compose add this block:

configurations.all {
    resolutionStrategy {
        force("org.jetbrains.skiko:skiko:0.7.88")
    }
}

It will force Skiko version, instead of Skiko version in Compose 1.5.10. (Sample project https://github.com/dima-avdeev-jb/reproduce-issue-3822-ios-crash-navigation/tree/13c602939d94904019bdb6a737ae2a09379617e3) After release of Compose 1.5.11 - you can remove this block and use default build.gradle.kts configuration.

I’m also having the same issue.

Hello! Thanks for this Issue.

What JDK version are you using to build this project? Can you please check command: java --version