This repository has been archived by the owner on Feb 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Need global locking in ASTextNodeRenderer. #29
Labels
Comments
secretiverhyme
changed the title
Crash on barebones test project due to over-release
Rare crash in -[ASTextNode measure:]
Sep 24, 2014
This code snippet in an empty project is sufficient to reproduce the zombie: for (NSInteger i = 0; i < 200; i++) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
ASTextNode *node = [[ASTextNode alloc] init];
[node measure:CGSizeMake(320, 480)];
NSLog(@"result: %@", NSStringFromCGSize(node.calculatedSize));
});
} |
As is this: for (NSInteger i = 0; i < 200; i++) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
NSTextStorage *textStorage = [[NSTextStorage alloc] init];
NSLayoutManager *layoutManager = [[NSLayoutManager alloc] init];
[textStorage addLayoutManager:layoutManager];
NSTextContainer *textContainer = [[NSTextContainer alloc] initWithSize:CGSizeMake(320, 480)];
[layoutManager addTextContainer:textContainer];
NSLog(@"%zd", i);
});
} Doesn't repro on a serial queue. |
Indicating we need a global sync lock on these parts. We were really hoping that this wasn't necessary... but I guess CTFrameSetterCreate... methods also aren't globally threadsafe, so honestly not too surprised. |
So now we need to narrow down on exactly which collection of methods are not globally threadsafe, and lock on the bare minimum of computational time. |
rdar://18448377 filed. |
secretiverhyme
changed the title
Rare crash in -[ASTextNode measure:]
Need global locking in ASTextNodeRenderer.
Sep 24, 2014
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Repro project:
http://www.atoulou.se/Repro.tar.bz2
Very barebones. Remember to set zombies to on. Tested using iPhone 5s (7.1) Simulator on OS X 10.9.
Crash 1 (almost every time):
Crash 2 (uncommon?):
The text was updated successfully, but these errors were encountered: