icerockdev / moko-resources

Resources access for mobile (android & ios) Kotlin Multiplatform development
https://moko.icerock.dev/
Apache License 2.0
1.07k stars 120 forks source link

iOS Crash with Compose Multiplatform : fontFamilyResource results in a crash on different font variations #581

Open yuroyami opened 11 months ago

yuroyami commented 11 months ago

I use Compose multiplatform 1.5.1 (and 1.5.10-beta01). I get a crash when using fontFamilyResource(MR.fonts.Directive4.bold) on iOS (any device or version). It works fine on Android.

How to reproduce : Create a normal Text composable with a custom FontFamily using moko-resources.

This also doesn't work:MR.fonts.YOUR_FONT.asFont()

Text(
    text = "Lorem Ipsum",
    fontFamily = FontFamily(MR.fonts.FooJaySansSerif.bold.asFont())
)

But it doesnt work. So yeah, I just can't use custom fonts in iOS. Maybe it works for 1.5.0 but I am not sure

EDIT: This happens because the font is bold, maybe because it doesn't have a regular variation ? See comment below.

NOTE: I only tested this with Text composables in Compose 1.5.1 and Material3

Here's the full crash report:

Full crash report ------------------------------------- Translated Report (Full Report Below) ------------------------------------- Incident Identifier: B5236F22-B07C-4E31-A023-F511C6F7034B CrashReporter Key: 378B04D7-3E25-65B4-D3DB-0DA5584BE7AF Hardware Model: MacBookAir7,2 Process: iosApp [12332] Path: /Users/USER/Library/Developer/CoreSimulator/Devices/E74CCD34-F064-40C4-AAEA-C5BC1DC0F8D7/data/Containers/Bundle/Application/C1422717-472B-40BA-A076-0C244CC6BAB8/iosApp.app/iosApp Identifier: com.yuroyami.syncplay Version: 1.0 (1) Code Type: X86-64 (Native) Role: Foreground Parent Process: launchd_sim [10521] Coalition: com.apple.CoreSimulator.SimDevice.E74CCD34-F064-40C4-AAEA-C5BC1DC0F8D7 [4719] Responsible Process: SimulatorTrampoline [788] Date/Time: 2023-09-18 20:38:02.9720 +0100 Launch Time: 2023-09-18 20:37:58.3888 +0100 OS Version: macOS 12.6.5 (21G531) Release Type: User Report Version: 104 Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Subtype: UNKNOWN_0xD at 0x0000000000000000 Exception Codes: 0x000000000000000d, 0x0000000000000000 VM Region Info: 0 is not in any region. Bytes before following region: 4433260544 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL UNUSED SPACE AT START ---> __TEXT 1083e3000-1083e7000 [ 16K] r-x/r-x SM=COW ...pp.app/iosApp Exception Note: EXC_CORPSE_NOTIFY Termination Reason: SIGNAL 11 Segmentation fault: 11 Terminating Process: exc handler [12332] Triggered by Thread: 0 Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 shared 0x10f32f0e4 kfun:kotlin.collections.HashMap.hash#internal + 116 (HashMap.kt:218) 1 shared 0x10f330340 kfun:kotlin.collections.HashMap#addKey(1:0){}kotlin.Int + 464 (HashMap.kt:294) 2 shared 0x10f33943c kfun:kotlin.collections.HashSet#add(1:0){}kotlin.Boolean + 236 (HashSet.kt:37) 3 shared 0x10f2cb6ca kfun:kotlin.Throwable.ExceptionTraceBuilder.dumpSelfTrace#internal + 874 (Throwable.kt:94) 4 shared 0x10f2cb1fe kfun:kotlin.Throwable.ExceptionTraceBuilder.dumpFullTrace#internal + 430 (Throwable.kt:84) 5 shared 0x10f2caebb kfun:kotlin.Throwable.ExceptionTraceBuilder.print#internal + 203 (Throwable.kt:71) 6 shared 0x10f2caa1c kfun:kotlin.Throwable#printStackTrace(){} + 188 (Throwable.kt:55) 7 shared 0x10f2ffda2 ReportUnhandledException + 146 (RuntimeUtils.kt:153) 8 shared 0x110135039 (anonymous namespace)::terminateWithUnhandledException(ObjHeader*)::$_1::operator()() const + 9 9 shared 0x110134f0f void (anonymous namespace)::$_0::operator()<(anonymous namespace)::terminateWithUnhandledException(ObjHeader*)::$_1>((anonymous namespace)::terminateWithUnhandledException(ObjHeader*)::$_1) + 47 10 shared 0x110134d29 (anonymous namespace)::terminateWithUnhandledException(ObjHeader*) + 9 11 shared 0x110134ce7 (anonymous namespace)::processUnhandledException(ObjHeader*) + 55 12 shared 0x1101349fc (anonymous namespace)::TerminateHandler::kotlinHandler() + 204 13 libc++abi.dylib 0x7ff800257b65 std::__terminate(void (*)()) + 8 14 libc++abi.dylib 0x7ff80025a3a4 __cxa_rethrow + 99 15 libobjc.A.dylib 0x7ff80004dd0d objc_exception_rethrow + 37 16 CoreFoundation 0x7ff800381769 CFRunLoopRunSpecific + 754 17 GraphicsServices 0x7ff809cb128a GSEventRunModal + 139 18 UIKitCore 0x10c6d9ad3 -[UIApplication _run] + 994 19 UIKitCore 0x10c6de9ef UIApplicationMain + 123 20 SwiftUI 0x1097b3667 0x1086bf000 + 17778279 21 SwiftUI 0x1097b3514 0x1086bf000 + 17777940 22 SwiftUI 0x108e177e9 0x1086bf000 + 7702505 23 iosApp 0x1083e61ee static iOSApp.$main() + 30 (iOSApp.swift:4) 24 iosApp 0x1083e6299 main + 9 25 dyld_sim 0x1086292bf start_sim + 10 26 dyld 0x10b7e552e start + 462 Thread 1:: GC Timer thread 0 libsystem_kernel.dylib 0x7ff8361193da __psynch_cvwait + 10 1 libsystem_pthread.dylib 0x7ff836174a6f _pthread_cond_wait + 1249 2 libc++.1.dylib 0x7ff800290c73 std::__1::condition_variable::__do_timed_wait(std::__1::unique_lockstd::__1::mutex&, std::__1::chrono::time_point > >) + 93 3 shared 0x1101457f0 void kotlin::RepeatedTimerkotlin::steady_clock::Run)::'lambda'()>(kotlin::gc::internal::GCSchedulerDataWithTimerkotlin::steady_clock::GCSchedulerDataWithTimer(kotlin::gc::GCSchedulerConfig&, std::__1::function)::'lambda'()&&) + 576 4 shared 0x110145f67 void* std::__1::__thread_proxy, void ()(kotlin::ScopedThread::attributes, void (kotlin::RepeatedTimerkotlin::steady_clock::&&)(kotlin::gc::internal::GCSchedulerDataWithTimerkotlin::steady_clock::GCSchedulerDataWithTimer(kotlin::gc::GCSchedulerConfig&, std::__1::function)::'lambda'()&&) noexcept, kotlin::RepeatedTimerkotlin::steady_clock&&, kotlin::gc::internal::GCSchedulerDataWithTimerkotlin::steady_clock::GCSchedulerDataWithTimer(kotlin::gc::GCSchedulerConfig&, std::__1::function)::'lambda'()&&), kotlin::ScopedThread::attributes, void (kotlin::RepeatedTimerkotlin::steady_clock::)(kotlin::gc::internal::GCSchedulerDataWithTimerkotlin::steady_clock::GCSchedulerDataWithTimer(kotlin::gc::GCSchedulerConfig&, std::__1::function)::'lambda'()&&) noexcept, kotlin::RepeatedTimerkotlin::steady_clock, kotlin::gc::internal::GCSchedulerDataWithTimerkotlin::steady_clock::GCSchedulerDataWithTimer(kotlin::gc::GCSchedulerConfig&, std::__1::function)::'lambda'()> >(void) + 247 5 libsystem_pthread.dylib 0x7ff8361744e1 _pthread_start + 125 6 libsystem_pthread.dylib 0x7ff83616ff6b thread_start + 15 Thread 2:: GC thread 0 libsystem_kernel.dylib 0x7ff8361193da __psynch_cvwait + 10 1 libsystem_pthread.dylib 0x7ff836174a6f _pthread_cond_wait + 1249 2 libc++.1.dylib 0x7ff800290be2 std::__1::condition_variable::wait(std::__1::unique_lockstd::__1::mutex&) + 18 3 shared 0x11013e776 std::__1::invoke_result::type kotlin::ScopedThread::Run(kotlin::ScopedThread::attributes, kotlin::gc::ConcurrentMarkAndSweep::ConcurrentMarkAndSweep(kotlin::mm::ObjectFactorykotlin::gc::ConcurrentMarkAndSweep&, kotlin::gc::GCScheduler&)::$_3&&) + 278 4 shared 0x11013e8d9 void* std::__1::__thread_proxy, void ()(kotlin::ScopedThread::attributes, kotlin::gc::ConcurrentMarkAndSweep::ConcurrentMarkAndSweep(kotlin::mm::ObjectFactorykotlin::gc::ConcurrentMarkAndSweep&, kotlin::gc::GCScheduler&)::$_3&&), kotlin::ScopedThread::attributes, kotlin::gc::ConcurrentMarkAndSweep::ConcurrentMarkAndSweep(kotlin::mm::ObjectFactorykotlin::gc::ConcurrentMarkAndSweep&, kotlin::gc::GCScheduler&)::$_3> >(void) + 217 5 libsystem_pthread.dylib 0x7ff8361744e1 _pthread_start + 125 6 libsystem_pthread.dylib 0x7ff83616ff6b thread_start + 15 Thread 3: 0 libsystem_kernel.dylib 0x7ff8361193da __psynch_cvwait + 10 1 libsystem_pthread.dylib 0x7ff836174a6f _pthread_cond_wait + 1249 2 shared 0x11014ebbb (anonymous namespace)::waitInNativeState(_opaque_pthread_cond_t*, _opaque_pthread_mutex_t*) + 107 3 shared 0x11014d955 Worker::processQueueElement(bool) + 597 4 shared 0x11014d65a (anonymous namespace)::workerRoutine(void*) + 122 5 libsystem_pthread.dylib 0x7ff8361744e1 _pthread_start + 125 6 libsystem_pthread.dylib 0x7ff83616ff6b thread_start + 15 Thread 4: 0 libsystem_pthread.dylib 0x7ff83616ff48 start_wqthread + 0 Thread 5: 0 libsystem_pthread.dylib 0x7ff83616ff48 start_wqthread + 0 Thread 6: 0 libsystem_pthread.dylib 0x7ff83616ff48 start_wqthread + 0 Thread 7: 0 libsystem_pthread.dylib 0x7ff83616ff48 start_wqthread + 0 Thread 8: 0 libsystem_pthread.dylib 0x7ff83616ff48 start_wqthread + 0 Thread 9: 0 libsystem_pthread.dylib 0x7ff83616ff48 start_wqthread + 0 Thread 10:: com.apple.uikit.eventfetch-thread 0 libsystem_kernel.dylib 0x7ff83611696a mach_msg_trap + 10 1 libsystem_kernel.dylib 0x7ff836116cd8 mach_msg + 56 2 CoreFoundation 0x7ff80038788e __CFRunLoopServiceMachPort + 145 3 CoreFoundation 0x7ff800381fdf __CFRunLoopRun + 1371 4 CoreFoundation 0x7ff8003816a7 CFRunLoopRunSpecific + 560 5 Foundation 0x7ff800c568b4 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 213 6 Foundation 0x7ff800c56b2d -[NSRunLoop(NSRunLoop) runUntilDate:] + 72 7 UIKitCore 0x10c7af286 -[UIEventFetcher threadMain] + 535 8 Foundation 0x7ff800c8011b NSThread__start + 1009 9 libsystem_pthread.dylib 0x7ff8361744e1 _pthread_start + 125 10 libsystem_pthread.dylib 0x7ff83616ff6b thread_start + 15 Thread 11: 0 libsystem_kernel.dylib 0x7ff8361193da __psynch_cvwait + 10 1 libsystem_pthread.dylib 0x7ff836174a6f _pthread_cond_wait + 1249 2 shared 0x11014ebbb (anonymous namespace)::waitInNativeState(_opaque_pthread_cond_t*, _opaque_pthread_mutex_t*) + 107 3 shared 0x11014d955 Worker::processQueueElement(bool) + 597 4 shared 0x11014d65a (anonymous namespace)::workerRoutine(void*) + 122 5 libsystem_pthread.dylib 0x7ff8361744e1 _pthread_start + 125 6 libsystem_pthread.dylib 0x7ff83616ff6b thread_start + 15 Thread 0 crashed with X86 Thread State (64-bit): rax: 0x8b481b78f68548c0 rbx: 0x0000600003ab4870 rcx: 0x00007ff800031e47 rdx: 0x00007ff7b7b1a528 rdi: 0x00007ff800031e47 rsi: 0x00007ff7b7b1a520 rbp: 0x00007ff7b7b1a530 rsp: 0x00007ff7b7b1a4c0 r8: 0x00007ff7b7b1aad8 r9: 0x00007ff7b7b1aad8 r10: 0x00007ff7b7b1aad0 r11: 0x00007ff7b7b1aac8 r12: 0x434c4e47432b2b00 r13: 0x0000600003db4300 r14: 0x0000600003ab48d0 r15: 0x434c4e47432b2b00 rip: 0x000000010f32f0e4 rfl: 0x0000000000010286 cr2: 0x000000010f2cb050 Logical CPU: 1 Error Code: 0x00000000 Trap Number: 13 Binary Images: 0x10f2b0000 - 0x110ee7fff com.yuroyami.syncplay.shared (1.0) <9af1d78d-e561-3a51-a667-3bf792a9fe83> /Users/USER/Library/Developer/CoreSimulator/Devices/E74CCD34-F064-40C4-AAEA-C5BC1DC0F8D7/data/Containers/Bundle/Application/C1422717-472B-40BA-A076-0C244CC6BAB8/iosApp.app/Frameworks/shared.framework/shared 0x7ff800248000 - 0x7ff80025dffb libc++abi.dylib () /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libc++abi.dylib 0x7ff80002c000 - 0x7ff80005ffe9 libobjc.A.dylib () <2a7a213a-fdb2-311c-81d7-efdfd9ddf25a> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib 0x7ff800303000 - 0x7ff80068bffc com.apple.CoreFoundation (6.9) <2be0f79f-8b25-3614-9e7e-dbac565f72dd> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation 0x7ff809cae000 - 0x7ff809cb5ff2 com.apple.GraphicsServices (1.0) <16365e42-1d5c-363d-84d1-3bb290a43253> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices 0x10b898000 - 0x10d363fff com.apple.UIKitCore (1.0) /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore 0x1086bf000 - 0x109da6fff com.apple.SwiftUI (4.2.11) <9125c1aa-27c9-3630-9548-d4d13d28c65a> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/SwiftUI.framework/SwiftUI 0x1083e3000 - 0x1083e6fff com.yuroyami.syncplay (1.0) <9acd6612-1907-38d5-b907-a0896887972e> /Users/USER/Library/Developer/CoreSimulator/Devices/E74CCD34-F064-40C4-AAEA-C5BC1DC0F8D7/data/Containers/Bundle/Application/C1422717-472B-40BA-A076-0C244CC6BAB8/iosApp.app/iosApp 0x108627000 - 0x108686fff dyld_sim () <6fb74554-3370-3677-93d4-7f7a01ea6a80> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/dyld_sim 0x10b7e0000 - 0x10b84bfff dyld () <6376ba16-20f7-3c31-a5c5-a10648ae7b56> /usr/lib/dyld 0x7ff836115000 - 0x7ff83614cfff libsystem_kernel.dylib () <576ecf56-10c7-35bf-a391-e35d4bd74309> /usr/lib/system/libsystem_kernel.dylib 0x7ff83616e000 - 0x7ff836179ff7 libsystem_pthread.dylib () <1239689d-21c9-36ce-96ba-be0ef8ee02e4> /usr/lib/system/libsystem_pthread.dylib 0x7ff800288000 - 0x7ff8002ddff7 libc++.1.dylib (*) /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libc++.1.dylib 0x7ff8006fe000 - 0x7ff80102eff4 com.apple.Foundation (6.9) <86cd050d-44fc-3045-a1f3-8ad5047b329e> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework/Foundation EOF Full Report {"app_name":"iosApp","timestamp":"2023-09-18 20:38:30.00 +0100","app_version":"1.0","slice_uuid":"9acd6612-1907-38d5-b907-a0896887972e","build_version":"1","platform":7,"bundleID":"com.yuroyami.syncplay","share_with_app_devs":0,"is_first_party":0,"bug_type":"309","os_version":"macOS 12.6.5 (21G531)","incident_id":"B5236F22-B07C-4E31-A023-F511C6F7034B","name":"iosApp"} { "uptime" : 31000, "procLaunch" : "2023-09-18 20:37:58.3888 +0100", "procRole" : "Foreground", "version" : 2, "userID" : 501, "deployVersion" : 210, "modelCode" : "MacBookAir7,2", "procStartAbsTime" : 31893287440411, "coalitionID" : 4719, "osVersion" : { "train" : "macOS 12.6.5", "build" : "21G531", "releaseType" : "User" }, "captureTime" : "2023-09-18 20:38:02.9720 +0100", "incident" : "B5236F22-B07C-4E31-A023-F511C6F7034B", "bug_type" : "309", "pid" : 12332, "procExitAbsTime" : 31895399127262, "cpuType" : "X86-64", "procName" : "iosApp", "procPath" : "/Users/USER/Library/Developer/CoreSimulator/Devices/E74CCD34-F064-40C4-AAEA-C5BC1DC0F8D7/data/Containers/Bundle/Application/C1422717-472B-40BA-A076-0C244CC6BAB8/iosApp.app/iosApp", "bundleInfo" : {"CFBundleShortVersionString":"1.0","CFBundleVersion":"1","CFBundleIdentifier":"com.yuroyami.syncplay"}, "storeInfo" : {"deviceIdentifierForVendor":"DA250D47-8C84-56AD-9682-EC6527F5F506","thirdParty":true}, "parentProc" : "launchd_sim", "parentPid" : 10521, "coalitionName" : "com.apple.CoreSimulator.SimDevice.E74CCD34-F064-40C4-AAEA-C5BC1DC0F8D7", "crashReporterKey" : "378B04D7-3E25-65B4-D3DB-0DA5584BE7AF", "responsiblePid" : 788, "responsibleProc" : "SimulatorTrampoline", "wakeTime" : 16914, "sleepWakeUUID" : "C9E380B7-468B-44D8-875B-EA09B5613602", "sip" : "enabled", "vmRegionInfo" : "0 is not in any region. Bytes before following region: 4433260544\n REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL\n UNUSED SPACE AT START\n---> \n __TEXT 1083e3000-1083e7000 [ 16K] r-x/r-x SM=COW ...pp.app/iosApp", "isCorpse" : 1, "exception" : {"codes":"0x000000000000000d, 0x0000000000000000","rawCodes":[13,0],"type":"EXC_BAD_ACCESS","signal":"SIGSEGV","subtype":"UNKNOWN_0xD at 0x0000000000000000"}, "termination" : {"flags":0,"code":11,"namespace":"SIGNAL","indicator":"Segmentation fault: 11","byProc":"exc handler","byPid":12332}, "vmregioninfo" : "0 is not in any region. Bytes before following region: 4433260544\n REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL\n UNUSED SPACE AT START\n---> \n __TEXT 1083e3000-1083e7000 [ 16K] r-x/r-x SM=COW ...pp.app/iosApp", "extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0}, "faultingThread" : 0, "threads" : [{"triggered":true,"id":271068,"instructionState":{"instructionStream":{"bytes":[72,137,69,208,72,139,77,200,72,139,85,192,72,139,69,208,72,137,198,72,131,198,24,72,137,117,176,72,137,80,24,72,137,194,72,131,194,32,72,137,85,184,72,137,72,32,138,5,40,170,235,1,36,1,60,0,116,5,232,13,181,223,0,235,0,72,139,69,184,72,131,56,0,117,7,49,192,137,69,172,235,67,72,139,69,184,72,139,56,72,139,7,72,131,224,252,72,139,0,255,144,136,0,0,0,137,69,168,72,139,69,176,139,77,168,105,201,185,121,55,158,137,77,160,72,139,56,232,104,209,255,255,137,69,164,139,69,160,139,77,164,131,225,31,211,232,137,69,172,139,69,172,137,69,156,139,69,156,72,131,196,112,93,195,15,31,132,0,0,0,0,0,85,72,137,229,72,129,236,96,1,0,0,72,137,189,112,255,255,255,72,141],"offset":96}},"threadState":{"r13":{"value":105553180967680},"rax":{"value":10036301975941105856},"rflags":{"value":66182},"cpu":{"value":1},"r14":{"value":105553177823440},"rsi":{"value":140701915522336},"r8":{"value":140701915523800},"cr2":{"value":4549554256},"rdx":{"value":140701915522344},"r10":{"value":140701915523792},"r9":{"value":140701915523800},"r15":{"value":4849336966747728640},"rbx":{"value":105553177823344},"trap":{"value":13},"err":{"value":0},"r11":{"value":140701915523784},"rip":{"value":4549964004,"matchesCrashFrame":1},"rbp":{"value":140701915522352},"rsp":{"value":140701915522240},"r12":{"value":4849336966747728640},"rcx":{"value":140703128821319,"symbolLocation":0,"symbol":"_objc_exception_noop"},"flavor":"x86_THREAD_STATE","rdi":{"value":140703128821319,"symbolLocation":0,"symbol":"_objc_exception_noop"}},"queue":"com.apple.main-thread","frames":[{"imageOffset":520420,"sourceLine":218,"sourceFile":"HashMap.kt","symbol":"kfun:kotlin.collections.HashMap.hash#internal","imageIndex":0,"symbolLocation":116},{"imageOffset":525120,"sourceLine":294,"sourceFile":"HashMap.kt","symbol":"kfun:kotlin.collections.HashMap#addKey(1:0){}kotlin.Int","imageIndex":0,"symbolLocation":464},{"imageOffset":562236,"sourceLine":37,"sourceFile":"HashSet.kt","symbol":"kfun:kotlin.collections.HashSet#add(1:0){}kotlin.Boolean","imageIndex":0,"symbolLocation":236},{"imageOffset":112330,"sourceLine":94,"sourceFile":"Throwable.kt","symbol":"kfun:kotlin.Throwable.ExceptionTraceBuilder.dumpSelfTrace#internal","imageIndex":0,"symbolLocation":874},{"imageOffset":111102,"sourceLine":84,"sourceFile":"Throwable.kt","symbol":"kfun:kotlin.Throwable.ExceptionTraceBuilder.dumpFullTrace#internal","imageIndex":0,"symbolLocation":430},{"imageOffset":110267,"sourceLine":71,"sourceFile":"Throwable.kt","symbol":"kfun:kotlin.Throwable.ExceptionTraceBuilder.print#internal","imageIndex":0,"symbolLocation":203},{"imageOffset":109084,"sourceLine":55,"sourceFile":"Throwable.kt","symbol":"kfun:kotlin.Throwable#printStackTrace(){}","imageIndex":0,"symbolLocation":188},{"imageOffset":327074,"sourceLine":153,"sourceFile":"RuntimeUtils.kt","symbol":"ReportUnhandledException","imageIndex":0,"symbolLocation":146},{"imageOffset":15224889,"symbol":"(anonymous namespace)::terminateWithUnhandledException(ObjHeader*)::$_1::operator()() const","symbolLocation":9,"imageIndex":0},{"imageOffset":15224591,"symbol":"void (anonymous namespace)::$_0::operator()<(anonymous namespace)::terminateWithUnhandledException(ObjHeader*)::$_1>((anonymous namespace)::terminateWithUnhandledException(ObjHeader*)::$_1)","symbolLocation":47,"imageIndex":0},{"imageOffset":15224105,"symbol":"(anonymous namespace)::terminateWithUnhandledException(ObjHeader*)","symbolLocation":9,"imageIndex":0},{"imageOffset":15224039,"symbol":"(anonymous namespace)::processUnhandledException(ObjHeader*)","symbolLocation":55,"imageIndex":0},{"imageOffset":15223292,"symbol":"(anonymous namespace)::TerminateHandler::kotlinHandler()","symbolLocation":204,"imageIndex":0},{"imageOffset":64357,"symbol":"std::__terminate(void ()())","symbolLocation":8,"imageIndex":1},{"imageOffset":74660,"symbol":"__cxa_rethrow","symbolLocation":99,"imageIndex":1},{"imageOffset":138509,"symbol":"objc_exception_rethrow","symbolLocation":37,"imageIndex":2},{"imageOffset":517993,"symbol":"CFRunLoopRunSpecific","symbolLocation":754,"imageIndex":3},{"imageOffset":12938,"symbol":"GSEventRunModal","symbolLocation":139,"imageIndex":4},{"imageOffset":14949075,"symbol":"-[UIApplication _run]","symbolLocation":994,"imageIndex":5},{"imageOffset":14969327,"symbol":"UIApplicationMain","symbolLocation":123,"imageIndex":5},{"imageOffset":17778279,"imageIndex":6},{"imageOffset":17777940,"imageIndex":6},{"imageOffset":7702505,"imageIndex":6},{"imageOffset":12782,"sourceLine":4,"sourceFile":"iOSApp.swift","symbol":"static iOSApp.$main()","imageIndex":7,"symbolLocation":30},{"imageOffset":12953,"sourceFile":"iOSApp.swift","symbol":"main","symbolLocation":9,"imageIndex":7},{"imageOffset":8895,"symbol":"start_sim","symbolLocation":10,"imageIndex":8},{"imageOffset":21806,"symbol":"start","symbolLocation":462,"imageIndex":9}]},{"id":271096,"name":"GC Timer thread","frames":[{"imageOffset":17370,"symbol":"__psynch_cvwait","symbolLocation":10,"imageIndex":10},{"imageOffset":27247,"symbol":"_pthread_cond_wait","symbolLocation":1249,"imageIndex":11},{"imageOffset":35955,"symbol":"std::__1::condition_variable::__do_timed_wait(std::__1::unique_lockstd::__1::mutex&, std::__1::chrono::time_point > >)","symbolLocation":93,"imageIndex":12},{"imageOffset":15292400,"symbol":"void kotlin::RepeatedTimerkotlin::steady_clock::Run)::'lambda'()>(kotlin::gc::internal::GCSchedulerDataWithTimerkotlin::steady_clock::GCSchedulerDataWithTimer(kotlin::gc::GCSchedulerConfig&, std::__1::function)::'lambda'()&&)","symbolLocation":576,"imageIndex":0},{"imageOffset":15294311,"symbol":"void std::__1::__thread_proxy, void ()(kotlin::ScopedThread::attributes, void (kotlin::RepeatedTimerkotlin::steady_clock::&&)(kotlin::gc::internal::GCSchedulerDataWithTimerkotlin::steady_clock::GCSchedulerDataWithTimer(kotlin::gc::GCSchedulerConfig&, std::__1::function)::'lambda'()&&) noexcept, kotlin::RepeatedTimerkotlin::steady_clock&&, kotlin::gc::internal::GCSchedulerDataWithTimerkotlin::steady_clock::GCSchedulerDataWithTimer(kotlin::gc::GCSchedulerConfig&, std::__1::function)::'lambda'()&&), kotlin::ScopedThread::attributes, void (kotlin::RepeatedTimerkotlin::steady_clock::)(kotlin::gc::internal::GCSchedulerDataWithTimerkotlin::steady_clock::GCSchedulerDataWithTimer(kotlin::gc::GCSchedulerConfig&, std::__1::function)::'lambda'()&&) noexcept, kotlin::RepeatedTimerkotlin::steady_clock, kotlin::gc::internal::GCSchedulerDataWithTimerkotlin::steady_clock::GCSchedulerDataWithTimer(kotlin::gc::GCSchedulerConfig&, std::__1::function)::'lambda'()> >(void)","symbolLocation":247,"imageIndex":0},{"imageOffset":25825,"symbol":"_pthread_start","symbolLocation":125,"imageIndex":11},{"imageOffset":8043,"symbol":"thread_start","symbolLocation":15,"imageIndex":11}]},{"id":271097,"name":"GC thread","frames":[{"imageOffset":17370,"symbol":"__psynch_cvwait","symbolLocation":10,"imageIndex":10},{"imageOffset":27247,"symbol":"_pthread_cond_wait","symbolLocation":1249,"imageIndex":11},{"imageOffset":35810,"symbol":"std::__1::condition_variable::wait(std::__1::unique_lockstd::__1::mutex&)","symbolLocation":18,"imageIndex":12},{"imageOffset":15263606,"symbol":"std::__1::invoke_result::type kotlin::ScopedThread::Run(kotlin::ScopedThread::attributes, kotlin::gc::ConcurrentMarkAndSweep::ConcurrentMarkAndSweep(kotlin::mm::ObjectFactorykotlin::gc::ConcurrentMarkAndSweep&, kotlin::gc::GCScheduler&)::$_3&&)","symbolLocation":278,"imageIndex":0},{"imageOffset":15263961,"symbol":"void* std::__1::__thread_proxy, void ()(kotlin::ScopedThread::attributes, kotlin::gc::ConcurrentMarkAndSweep::ConcurrentMarkAndSweep(kotlin::mm::ObjectFactorykotlin::gc::ConcurrentMarkAndSweep&, kotlin::gc::GCScheduler&)::$_3&&), kotlin::ScopedThread::attributes, kotlin::gc::ConcurrentMarkAndSweep::ConcurrentMarkAndSweep(kotlin::mm::ObjectFactorykotlin::gc::ConcurrentMarkAndSweep&, kotlin::gc::GCScheduler&)::$_3> >(void)","symbolLocation":217,"imageIndex":0},{"imageOffset":25825,"symbol":"_pthread_start","symbolLocation":125,"imageIndex":11},{"imageOffset":8043,"symbol":"thread_start","symbolLocation":15,"imageIndex":11}]},{"id":271098,"frames":[{"imageOffset":17370,"symbol":"__psynch_cvwait","symbolLocation":10,"imageIndex":10},{"imageOffset":27247,"symbol":"_pthread_cond_wait","symbolLocation":1249,"imageIndex":11},{"imageOffset":15330235,"symbol":"(anonymous namespace)::waitInNativeState(_opaque_pthread_cond_t*, _opaque_pthread_mutex_t*)","symbolLocation":107,"imageIndex":0},{"imageOffset":15325525,"symbol":"Worker::processQueueElement(bool)","symbolLocation":597,"imageIndex":0},{"imageOffset":15324762,"symbol":"(anonymous namespace)::workerRoutine(void*)","symbolLocation":122,"imageIndex":0},{"imageOffset":25825,"symbol":"_pthread_start","symbolLocation":125,"imageIndex":11},{"imageOffset":8043,"symbol":"thread_start","symbolLocation":15,"imageIndex":11}]},{"id":271099,"frames":[{"imageOffset":8008,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":11}]},{"id":271100,"frames":[{"imageOffset":8008,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":11}]},{"id":271101,"frames":[{"imageOffset":8008,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":11}]},{"id":271102,"frames":[{"imageOffset":8008,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":11}]},{"id":271103,"frames":[{"imageOffset":8008,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":11}]},{"id":271104,"frames":[{"imageOffset":8008,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":11}]},{"id":271105,"name":"com.apple.uikit.eventfetch-thread","frames":[{"imageOffset":6506,"symbol":"mach_msg_trap","symbolLocation":10,"imageIndex":10},{"imageOffset":7384,"symbol":"mach_msg","symbolLocation":56,"imageIndex":10},{"imageOffset":542862,"symbol":"__CFRunLoopServiceMachPort","symbolLocation":145,"imageIndex":3},{"imageOffset":520159,"symbol":"__CFRunLoopRun","symbolLocation":1371,"imageIndex":3},{"imageOffset":517799,"symbol":"CFRunLoopRunSpecific","symbolLocation":560,"imageIndex":3},{"imageOffset":5605556,"symbol":"-[NSRunLoop(NSRunLoop) runMode:beforeDate:]","symbolLocation":213,"imageIndex":13},{"imageOffset":5606189,"symbol":"-[NSRunLoop(NSRunLoop) runUntilDate:]","symbolLocation":72,"imageIndex":13},{"imageOffset":15823494,"symbol":"-[UIEventFetcher threadMain]","symbolLocation":535,"imageIndex":5},{"imageOffset":5775643,"symbol":"NSThread__start","symbolLocation":1009,"imageIndex":13},{"imageOffset":25825,"symbol":"_pthread_start","symbolLocation":125,"imageIndex":11},{"imageOffset":8043,"symbol":"thread_start","symbolLocation":15,"imageIndex":11}]},{"id":271118,"frames":[{"imageOffset":17370,"symbol":"__psynch_cvwait","symbolLocation":10,"imageIndex":10},{"imageOffset":27247,"symbol":"_pthread_cond_wait","symbolLocation":1249,"imageIndex":11},{"imageOffset":15330235,"symbol":"(anonymous namespace)::waitInNativeState(_opaque_pthread_cond_t*, _opaque_pthread_mutex_t*)","symbolLocation":107,"imageIndex":0},{"imageOffset":15325525,"symbol":"Worker::processQueueElement(bool)","symbolLocation":597,"imageIndex":0},{"imageOffset":15324762,"symbol":"(anonymous namespace)::workerRoutine(void*)","symbolLocation":122,"imageIndex":0},{"imageOffset":25825,"symbol":"_pthread_start","symbolLocation":125,"imageIndex":11},{"imageOffset":8043,"symbol":"thread_start","symbolLocation":15,"imageIndex":11}]}], "usedImages" : [ { "source" : "P", "arch" : "x86_64", "base" : 4549443584, "CFBundleShortVersionString" : "1.0", "CFBundleIdentifier" : "com.yuroyami.syncplay.shared", "size" : 29589504, "uuid" : "9af1d78d-e561-3a51-a667-3bf792a9fe83", "path" : "/Users/USER/Library/Developer/CoreSimulator/Devices/E74CCD34-F064-40C4-AAEA-C5BC1DC0F8D7/data/Containers/Bundle/Application/C1422717-472B-40BA-A076-0C244CC6BAB8/iosApp.app/Frameworks/shared.framework/shared", "name" : "shared", "CFBundleVersion" : "1" }, { "source" : "P", "arch" : "x86_64", "base" : 140703131009024, "size" : 90108, "uuid" : "ae8cbd53-0926-3251-b648-6f32d9330a50", "path" : "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libc++abi.dylib", "name" : "libc++abi.dylib" }, { "source" : "P", "arch" : "x86_64", "base" : 140703128797184, "size" : 212970, "uuid" : "2a7a213a-fdb2-311c-81d7-efdfd9ddf25a", "path" : "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib", "name" : "libobjc.A.dylib" }, { "source" : "P", "arch" : "x86_64", "base" : 140703131774976, "CFBundleShortVersionString" : "6.9", "CFBundleIdentifier" : "com.apple.CoreFoundation", "size" : 3706877, "uuid" : "2be0f79f-8b25-3614-9e7e-dbac565f72dd", "path" : "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation", "name" : "CoreFoundation", "CFBundleVersion" : "1953.300" }, { "source" : "P", "arch" : "x86_64", "base" : 140703292907520, "CFBundleShortVersionString" : "1.0", "CFBundleIdentifier" : "com.apple.GraphicsServices", "size" : 32755, "uuid" : "16365e42-1d5c-363d-84d1-3bb290a43253", "path" : "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices", "name" : "GraphicsServices", "CFBundleVersion" : "1.0" }, { "source" : "P", "arch" : "x86_64", "base" : 4488527872, "CFBundleShortVersionString" : "1.0", "CFBundleIdentifier" : "com.apple.UIKitCore", "size" : 28098560, "uuid" : "adb282b1-2fb2-38e0-8492-47f9443eb1ef", "path" : "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore", "name" : "UIKitCore", "CFBundleVersion" : "6209" }, { "source" : "P", "arch" : "x86_64", "base" : 4436258816, "CFBundleShortVersionString" : "4.2.11", "CFBundleIdentifier" : "com.apple.SwiftUI", "size" : 24018944, "uuid" : "9125c1aa-27c9-3630-9548-d4d13d28c65a", "path" : "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/SwiftUI.framework/SwiftUI", "name" : "SwiftUI", "CFBundleVersion" : "4.2.11" }, { "source" : "P", "arch" : "x86_64", "base" : 4433260544, "CFBundleShortVersionString" : "1.0", "CFBundleIdentifier" : "com.yuroyami.syncplay", "size" : 16384, "uuid" : "9acd6612-1907-38d5-b907-a0896887972e", "path" : "/Users/USER/Library/Developer/CoreSimulator/Devices/E74CCD34-F064-40C4-AAEA-C5BC1DC0F8D7/data/Containers/Bundle/Application/C1422717-472B-40BA-A076-0C244CC6BAB8/iosApp.app/iosApp", "name" : "iosApp", "CFBundleVersion" : "1" }, { "source" : "P", "arch" : "x86_64", "base" : 4435636224, "size" : 393216, "uuid" : "6fb74554-3370-3677-93d4-7f7a01ea6a80", "path" : "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/dyld_sim", "name" : "dyld_sim" }, { "source" : "P", "arch" : "x86_64", "base" : 4487774208, "size" : 442368, "uuid" : "6376ba16-20f7-3c31-a5c5-a10648ae7b56", "path" : "/usr/lib/dyld", "name" : "dyld" }, { "source" : "P", "arch" : "x86_64", "base" : 140704035721216, "size" : 229376, "uuid" : "576ecf56-10c7-35bf-a391-e35d4bd74309", "path" : "/usr/lib/system/libsystem_kernel.dylib", "name" : "libsystem_kernel.dylib" }, { "source" : "P", "arch" : "x86_64", "base" : 140704036085760, "size" : 49144, "uuid" : "1239689d-21c9-36ce-96ba-be0ef8ee02e4", "path" : "/usr/lib/system/libsystem_pthread.dylib", "name" : "libsystem_pthread.dylib" }, { "source" : "P", "arch" : "x86_64", "base" : 140703131271168, "size" : 352248, "uuid" : "abce3b9b-68eb-393b-bbc9-0d66a1806f17", "path" : "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libc++.1.dylib", "name" : "libc++.1.dylib" }, { "source" : "P", "arch" : "x86_64", "base" : 140703135948800, "CFBundleShortVersionString" : "6.9", "CFBundleIdentifier" : "com.apple.Foundation", "size" : 9637877, "uuid" : "86cd050d-44fc-3045-a1f3-8ad5047b329e", "path" : "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework/Foundation", "name" : "Foundation", "CFBundleVersion" : "1953.300" } ], "sharedCache" : { "base" : 140703128616960, "size" : 3002335232, "uuid" : "88d0ae14-3df4-30d2-8171-2f35a6450b46" }, "vmSummary" : "ReadOnly portion of Libraries: Total=820.0M resident=0K(0%) swapped_out_or_unallocated=820.0M(100%)\nWritable regions: Total=597.0M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=597.0M(100%)\n\n VIRTUAL REGION \nREGION TYPE SIZE COUNT (non-coalesced) \n=========== ======= ======= \nActivity Tracing 256K 1 \nColorSync 88K 5 \nCoreAnimation 4K 1 \nFoundation 16K 1 \nIOAccelerator 256.0M 42 \nIOSurface 13.0M 1 \nKernel Alloc Once 8K 1 \nMALLOC 177.4M 29 \nMALLOC guard page 32K 8 \nMALLOC_NANO (reserved) 384.0M 1 reserved VM address space (unallocated)\nSTACK GUARD 56.0M 12 \nStack 13.6M 12 \nVM_ALLOCATE 1052K 4 \n__DATA 12.8M 349 \n__DATA_CONST 31.4M 358 \n__DATA_DIRTY 26K 12 \n__FONT_DATA 4K 1 \n__LINKEDIT 385.9M 23 \n__OBJC_RO 28.4M 1 \n__OBJC_RW 882K 1 \n__TEXT 434.1M 368 \ndyld private memory 1280K 2 \nmapped file 38.5M 8 \nshared memory 16K 1 \n=========== ======= ======= \nTOTAL 1.8G 1242 \nTOTAL, minus reserved VM space 1.4G 1242 \n", "legacyInfo" : { "threadTriggered" : { "queue" : "com.apple.main-thread" } }, "trialInfo" : { "rollouts" : [ { "rolloutId" : "60186475825c62000ccf5450", "factorPackIds" : { }, "deploymentId" : 240000062 }, { "rolloutId" : "607844aa04477260f58a8077", "factorPackIds" : { "SIRI_MORPHUN_ASSETS" : "6103050cbfe6dc472e1c982a" }, "deploymentId" : 240000066 } ], "experiments" : [ { "treatmentId" : "6dd670af-0633-45e4-ae5f-122ae4df02be", "experimentId" : "64406ba83deb637ac8a04419", "deploymentId" : 900000017 } ] } }

For testing purposes I attached the faulty font below. Just to put things into perspective: it crashes when it's named Directive4-Bold.otf, but works fine when it's named Directive4-Regular.otf

Directive4-Regular.otf.zip

yuroyami commented 11 months ago

Confirmed that this happens only when I use a font variation that doesn't have regular variation. For example

MR.fonts.FooJay.bold.asFont(). doesn't work if FooJay.regular doesn't exist...

But when I use a regular font like MR.fonts.FooBar.regular.asFont() it works just fine... even if it is otf or ttf

I wonder if this is a iOS limitation or just a moko bug.

My solution was to rename my FooJay-Bold.otf to FooJay-Regular.otf

codlab commented 11 months ago

Just curious, what is the crash you got ? I personally encounter a crash using a MyFont-Regular.ttf (using cocoa pods configuration snippet from the readme where copying the resources via a script when compiling)

In my case the crash is "Exception NSException * "*** -[NSMutableDictionary __addObject:forKey:]: object cannot be nil" 0x000000028396ef40"

and the font family is retrieved via fontFamilyResource(fontResource = Resources.fonts.MyFont.regular)

(if my issue is not related, I'll create a new ticket, will need to take some time to create a minimum reproduction project)

Capture d’écran 2023-09-19 à 06 32 27
yuroyami commented 11 months ago

@codlab This is the same crash I got, exactly on Skia's Paragraph.kt. So there is no need to open a new ticket. I will rename the issue accordingly.

There is something that's leading the code to crash when using certain font variations for different fonts. For example, my Directive4 font is literally bold, but it doesn't work unless I define it as regular.

You could try renaming your font to MyFont-Bold.ttf. You can also try having another copy of your MyFont-Regular.ttf and rename it to MyFont-Bold.ttf. I am thinking maybe it's all about the font family lacking certain variations or something. I am not an iOS dev expert so I wonder what the underlying system requires the fonts to be like. Anyway, the aforementioned workaround may may help the maintainers put their finger on the issue.

codlab commented 11 months ago

I don't think it's about the variations, in my case there is only the default variation. It must be about the variation(s) not properly loading. What I was thinking about is that the compilation passed because the generation tells that the value exist but then, at runtime, it crashes because the value can't be loaded properly and then the validation of type then tries to push a null value to a dictionary when it expected non null

it's definitely somewhere in between the resource lookup & loading it. Haven't successfully recompiled the lib for now tho

yuroyami commented 11 months ago

My apologies for the ambiguity, I am aware that your font is named based on its actual/default variation, which in my case corresponds to the Bold variation. However, renaming my font to Directive4-Regular.otf worked although the font itself is bold.

It seems indeed to be an issue around loading the font at runtime. From what i understand about iOS frameworks, I wonder if migrating towards a static framework rather than a dynamic one would work, but I dislike the hassle of adding extra compile steps.

codlab commented 11 months ago

In my case the framework is built as static (hence the script as noted in the readme to copy the resources from it to the app) - even tried manually adding manually the font to the app as a resource