-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit implements the following PR as a patch to RCTFont.mm. facebook/react-native#22607 This is an attempt at fixing a high count Bugsnag reported crash which has a profile similar to facebook/react-native#13588
- Loading branch information
1 parent
f9d1909
commit e06e09e
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- RCTFont.mm 2018-11-09 01:14:13.000000000 -0800 | ||
+++ RCTFont.new.mm 2019-03-04 00:13:43.000000000 -0800 | ||
@@ -145,12 +145,12 @@ | ||
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<std::mutex> lock(fontCacheMutex); | ||
+ std::lock_guard<std::mutex> lock(*fontCacheMutex); | ||
if (!fontCache) { | ||
fontCache = [NSCache new]; | ||
} | ||
@@ -177,7 +177,7 @@ | ||
} | ||
|
||
{ | ||
- std::lock_guard<std::mutex> lock(fontCacheMutex); | ||
+ std::lock_guard<std::mutex> lock(*fontCacheMutex); | ||
[fontCache setObject:font forKey:cacheKey]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters