Avoid triggering main thread assertions in collection/table dealloc #trivial (#803)

* Avoid triggering main thread assertions in ASCollectionNode/ASTableNode dealloc

* Put it back
This commit is contained in:
Adlai Holler 2018-02-13 12:02:30 -08:00 committed by GitHub
parent e2478fc799
commit 8b431733d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 4 deletions

View File

@ -172,12 +172,17 @@
return self; return self;
} }
#if ASDISPLAYNODE_ASSERTIONS_ENABLED
- (void)dealloc - (void)dealloc
{ {
if ([self isNodeLoaded]) { if (self.nodeLoaded) {
ASDisplayNodeAssert(self.view.superview == nil, @"Node's view should be removed from hierarchy."); __weak UIView *view = self.view;
ASPerformBlockOnMainThread(^{
ASDisplayNodeCAssertNil(view.superview, @"Node's view should be removed from hierarchy.");
});
} }
} }
#endif
#pragma mark ASDisplayNode #pragma mark ASDisplayNode

View File

@ -104,12 +104,17 @@
return [self initWithStyle:UITableViewStylePlain]; return [self initWithStyle:UITableViewStylePlain];
} }
#if ASDISPLAYNODE_ASSERTIONS_ENABLED
- (void)dealloc - (void)dealloc
{ {
if ([self isNodeLoaded]) { if (self.nodeLoaded) {
ASDisplayNodeAssert(self.view.superview == nil, @"Node's view should be removed from hierarchy."); __weak UIView *view = self.view;
ASPerformBlockOnMainThread(^{
ASDisplayNodeCAssertNil(view.superview, @"Node's view should be removed from hierarchy.");
});
} }
} }
#endif
#pragma mark ASDisplayNode #pragma mark ASDisplayNode