Skip to content

Commit

Permalink
Merge pull request #1268 from EdgeApp/paul/patchRctFont
Browse files Browse the repository at this point in the history
Patch RCTFont.mm to fix crash
  • Loading branch information
paullinator authored Mar 5, 2019
2 parents bc80303 + 3464738 commit a472edd
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
26 changes: 26 additions & 0 deletions patches/RCTFont.patch
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];
}
}
4 changes: 4 additions & 0 deletions postinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,8 @@ unamestr=`uname`
if [[ "$unamestr" == 'Darwin' ]]; then
cd ios
pod install
cd ..
fi

# Apply patches
patch ./node_modules/react-native/React/Views/RCTFont.mm ./patches/RCTFont.patch

0 comments on commit a472edd

Please sign in to comment.