Skip to content

Commit

Permalink
ASTextNode should avoid acquiring its lock multiple times #trivial (T…
Browse files Browse the repository at this point in the history
…extureGroup#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.
  • Loading branch information
nguyenhuy authored and bernieperez committed Apr 25, 2018
1 parent 8efeb29 commit 52fdc6c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Source/ASTextNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ - (void)_setHighlightRange:(NSRange)highlightRange forAttributeName:(NSString *)

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];
Expand Down

0 comments on commit 52fdc6c

Please sign in to comment.