diff --git a/Source/ASNetworkImageNode.h b/Source/ASNetworkImageNode.h index f77a9a59d..576cbb94b 100644 --- a/Source/ASNetworkImageNode.h +++ b/Source/ASNetworkImageNode.h @@ -145,6 +145,15 @@ NS_ASSUME_NONNULL_BEGIN @protocol ASNetworkImageNodeDelegate @optional +/** + * Notification that the image node started to load + * + * @param imageNode The sender. + * + * @discussion Called on the main thread. + */ +- (void)imageNodeDidStartFetchingData:(ASNetworkImageNode *)imageNode; + /** * Notification that the image node finished downloading an image, with additional info. * If implemented, this method will be called instead of `imageNode:didLoadImage:`. @@ -167,15 +176,6 @@ NS_ASSUME_NONNULL_BEGIN */ - (void)imageNode:(ASNetworkImageNode *)imageNode didLoadImage:(UIImage *)image; -/** - * Notification that the image node started to load - * - * @param imageNode The sender. - * - * @discussion Called on a background queue. - */ -- (void)imageNodeDidStartFetchingData:(ASNetworkImageNode *)imageNode; - /** * Notification that the image node failed to download the image. * @@ -190,6 +190,8 @@ NS_ASSUME_NONNULL_BEGIN * Notification that the image node finished decoding an image. * * @param imageNode The sender. + * + * @discussion Called on the main thread. */ - (void)imageNodeDidFinishDecoding:(ASNetworkImageNode *)imageNode; diff --git a/Source/ASNetworkImageNode.mm b/Source/ASNetworkImageNode.mm index ce864647a..ea863c1ee 100644 --- a/Source/ASNetworkImageNode.mm +++ b/Source/ASNetworkImageNode.mm @@ -614,6 +614,8 @@ - (void)_downloadImageWithCompletion:(void (^)(id ima - (void)_lazilyLoadImageIfNecessary { + ASDisplayNodeAssertMainThread(); + [self lock]; __weak id delegate = _delegate; BOOL delegateDidStartFetchingData = _delegateFlags.delegateDidStartFetchingData;