iOS: fix crash when on concurrent op
This commit is contained in:
parent
9a6ae9b6ef
commit
e345aa8879
@ -44,11 +44,23 @@ - (instancetype)initWithName:(NSString *)name {
|
||||
}
|
||||
|
||||
- (void)addAnchorHook:(id)hook {
|
||||
[self.hooks addObject:hook];
|
||||
__weak typeof(self) _self = self;
|
||||
dispatch_async(self.anchorQueue, ^{
|
||||
__strong typeof(_self) self = _self;
|
||||
if (!self) return;
|
||||
|
||||
[self.hooks addObject:hook];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)removeAnchorHook:(id)hook {
|
||||
[self.hooks removeObject:hook];
|
||||
__weak typeof(self) _self = self;
|
||||
dispatch_async(self.anchorQueue, ^{
|
||||
__strong typeof(_self) self = _self;
|
||||
if (!self) return;
|
||||
|
||||
[self.hooks removeObject:hook];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)enable:(bool)enable {
|
||||
@ -95,7 +107,11 @@ - (void)print:(NSString *)anchorName {
|
||||
if (!self.enable) {
|
||||
return;
|
||||
}
|
||||
__weak typeof(self) _self = self;
|
||||
dispatch_async(self.anchorQueue, ^{
|
||||
__strong typeof(_self) self = _self;
|
||||
if (!self) return;
|
||||
|
||||
NSNumber *prepare = self.anchorMap[[self getPrepareAnchor:anchorName]];
|
||||
NSNumber *start = self.anchorMap[[self getStartAnchor:anchorName]];
|
||||
NSNumber *end = self.anchorMap[[self getEndAnchor:anchorName]];
|
||||
|
Reference in New Issue
Block a user