facebookarchive / AsyncDisplayKit

Smooth asynchronous user interfaces for iOS apps.

Home Page:http://asyncdisplaykit.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sometimes `ASPerformMainThreadDeallocation` does not work

cuihanxiu opened this issue · comments

My gesture is dealloated on sub thread


// ViewController
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    __block SubNode *node = [SubNode new];
    node.aGestureRecognizer = [CustomGesture new];
    dispatch_async(dispatch_get_global_queue(0, 0), ^{
        NSLog(@"+++%@, %@", node, NSThread.currentThread);
        node = nil;
    });
}

// SubNode
@interface SubNode : ASDisplayNode

@property (nonatomic, nullable) UIGestureRecognizer *aGestureRecognizer;

@end

//  CustomGesture
@implementation CustomGesture

- (void)dealloc {
    if (![NSThread isMainThread]) {
        NSLog(@"+++ sub thread");
    }
}

@end


It's ok in Texture, thank you.