From f440626c3ea89569cf4ec4b37e20dbf095cb8211 Mon Sep 17 00:00:00 2001 From: Tomek Zawadzki Date: Fri, 5 Jul 2024 12:15:39 +0200 Subject: [PATCH] Fix crash on Fabric iOS caused by concurrent runtime access --- ios/RCTMarkdownUtils.mm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ios/RCTMarkdownUtils.mm b/ios/RCTMarkdownUtils.mm index 2338a222..913b718b 100644 --- a/ios/RCTMarkdownUtils.mm +++ b/ios/RCTMarkdownUtils.mm @@ -28,6 +28,9 @@ - (NSAttributedString *)parseMarkdown:(nullable NSAttributedString *)input withA } static std::shared_ptr runtime; + static std::mutex runtimeMutex; + auto lock = std::lock_guard(runtimeMutex); + if (runtime == nullptr) { NSString *path = [[NSBundle mainBundle] pathForResource:@"react-native-live-markdown-parser" ofType:@"js"]; assert(path != nil && "[react-native-live-markdown] Markdown parser bundle not found");