diff --git a/React/Views/RCTFont.mm b/React/Views/RCTFont.mm index e26fcd89bc810b..d783722cc94c59 100644 --- a/React/Views/RCTFont.mm +++ b/React/Views/RCTFont.mm @@ -126,12 +126,12 @@ static inline BOOL CompareFontWeights(UIFontWeight firstWeight, UIFontWeight sec static UIFont *cachedSystemFont(CGFloat size, RCTFontWeight weight) { static NSCache *fontCache; - static std::mutex fontCacheMutex; + static std::mutex *fontCacheMutex = new std::mutex; NSString *cacheKey = [NSString stringWithFormat:@"%.1f/%.2f", size, weight]; UIFont *font; { - std::lock_guard lock(fontCacheMutex); + std::lock_guard lock(*fontCacheMutex); if (!fontCache) { fontCache = [NSCache new]; } @@ -158,7 +158,7 @@ static inline BOOL CompareFontWeights(UIFontWeight firstWeight, UIFontWeight sec } { - std::lock_guard lock(fontCacheMutex); + std::lock_guard lock(*fontCacheMutex); [fontCache setObject:font forKey:cacheKey]; } }