Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Fix threadSafeBounds #1319

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions AsyncDisplayKit/ASDisplayNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -429,13 +429,11 @@ - (UIView *)_viewToLoad
ASDisplayNodeAssert(![view isKindOfClass:[_ASDisplayView class]], @"View block should return a synchronously displayed view");
_viewBlock = nil;
_viewClass = [view class];
_usesDisplayView = NO;
} else {
if (!_viewClass) {
_viewClass = [self.class viewClass];
}
view = [[_viewClass alloc] init];
_usesDisplayView = [_viewClass isKindOfClass:[_ASDisplayView class]];
}

return view;
Expand Down
6 changes: 6 additions & 0 deletions AsyncDisplayKit/Details/_ASDisplayLayer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ - (void)setDisplaySuspended:(BOOL)displaySuspended
}
}

- (void)setBounds:(CGRect)bounds
{
[super setBounds:bounds];
self.asyncdisplaykit_node.threadSafeBounds = bounds;
}

#if DEBUG // These override is strictly to help detect application-level threading errors. Avoid method overhead in release.
- (void)setContents:(id)contents
{
Expand Down
6 changes: 2 additions & 4 deletions AsyncDisplayKit/Private/ASDisplayNode+UIViewBridge.mm
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#import "ASEqualityHelpers.h"
#import "ASPendingStateController.h"
#import "ASThread.h"
#import "ASTextNode.h"

/**
* The following macros are conveniences to help in the common tasks related to the bridging that ASDisplayNode does to UIView and CALayer.
Expand Down Expand Up @@ -211,10 +212,7 @@ - (void)setBounds:(CGRect)newBounds
{
_bridge_prologue_write;
_setToViewOrLayer(bounds, newBounds, bounds, newBounds);
// If _ASDisplayView is available, it already sets the new bounds to threadSafeBounds.
if (! (__loaded(self) && _usesDisplayView)) {
self.threadSafeBounds = newBounds;
}
self.threadSafeBounds = newBounds;
}

- (CGRect)frame
Expand Down
1 change: 0 additions & 1 deletion AsyncDisplayKit/Private/ASDisplayNodeInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ FOUNDATION_EXPORT NSString * const ASRenderingEngineDidDisplayNodesScheduledBefo
ASDisplayNodeDidLoadBlock _nodeLoadedBlock;
Class _viewClass;
Class _layerClass;
BOOL _usesDisplayView;

UIImage *_placeholderImage;
CALayer *_placeholderLayer;
Expand Down