facebookarchive / AsyncDisplayKit

Smooth asynchronous user interfaces for iOS apps.
http://asyncdisplaykit.org
Other
13.4k stars 2.2k forks source link

Sometimes `ASPerformMainThreadDeallocation` does not work #3355

Closed cuihanxiu closed 4 years ago

cuihanxiu commented 4 years ago

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
appleguy commented 4 years ago

This should work correctly in the current code, which is all at texturegroup.org . This repo is deprecated.

Sent from my iPhone

On Jun 17, 2020, at 5:06 AM, cuihanxiu notifications@github.com wrote:

 My gesture is dealloated on sub thread

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

cuihanxiu commented 4 years ago

It's ok in Texture, thank you.