ASTextNode should avoid acquiring its lock multiple times #trivial (#820)

Since the lock was acquire before we try to access the renderer, we should call `-_locked_renderer` to avoid re-acquiring the same (recursive) lock.
This commit is contained in:
Huy Nguyen
2018-03-09 22:23:41 +00:00
committed by Adlai Holler
parent 6f1d2d1f1d
commit e0d07d07ef

View File

@@ -769,7 +769,7 @@ static NSArray *DefaultLinkAttributeNames = @[ NSLinkAttributeName ];
if (highlightTargetLayer != nil) {
ASDN::MutexLocker l(__instanceLock__);
ASTextKitRenderer *renderer = [self _renderer];
ASTextKitRenderer *renderer = [self _locked_renderer];
NSArray *highlightRects = [renderer rectsForTextRange:highlightRange measureOption:ASTextKitRendererMeasureOptionBlock];
NSMutableArray *converted = [NSMutableArray arrayWithCapacity:highlightRects.count];