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

Commit 4ddd1f4

Browse files
committed
Merge pull request #478 from victormayorov/master
Fixed crash in ASNetworkImageNode.
2 parents c1f3ce2 + 645b3c1 commit 4ddd1f4

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

AsyncDisplayKit.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
05EA6FE71AC0966E00E35788 /* ASSnapshotTestCase.mm in Sources */ = {isa = PBXBuildFile; fileRef = 05EA6FE61AC0966E00E35788 /* ASSnapshotTestCase.mm */; };
142142
05F20AA41A15733C00DCA68A /* ASImageProtocols.h in Headers */ = {isa = PBXBuildFile; fileRef = 05F20AA31A15733C00DCA68A /* ASImageProtocols.h */; settings = {ATTRIBUTES = (Public, ); }; };
143143
1950C4491A3BB5C1005C8279 /* ASEqualityHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 1950C4481A3BB5C1005C8279 /* ASEqualityHelpers.h */; };
144+
242995D31B29743C00090100 /* ASBasicImageDownloaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 242995D21B29743C00090100 /* ASBasicImageDownloaderTests.m */; };
144145
2911485C1A77147A005D0878 /* ASControlNodeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2911485B1A77147A005D0878 /* ASControlNodeTests.m */; };
145146
291B63FB1AA53A7A000A71B3 /* ASScrollDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = 296A0A311A951715005ACEAA /* ASScrollDirection.h */; settings = {ATTRIBUTES = (Public, ); }; };
146147
292C599F1A956527007E5DD6 /* ASLayoutRangeType.h in Headers */ = {isa = PBXBuildFile; fileRef = 292C59991A956527007E5DD6 /* ASLayoutRangeType.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -316,6 +317,7 @@
316317
05EA6FE61AC0966E00E35788 /* ASSnapshotTestCase.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASSnapshotTestCase.mm; sourceTree = "<group>"; };
317318
05F20AA31A15733C00DCA68A /* ASImageProtocols.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASImageProtocols.h; sourceTree = "<group>"; };
318319
1950C4481A3BB5C1005C8279 /* ASEqualityHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASEqualityHelpers.h; sourceTree = "<group>"; };
320+
242995D21B29743C00090100 /* ASBasicImageDownloaderTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASBasicImageDownloaderTests.m; sourceTree = "<group>"; };
319321
2911485B1A77147A005D0878 /* ASControlNodeTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASControlNodeTests.m; sourceTree = "<group>"; };
320322
292C59991A956527007E5DD6 /* ASLayoutRangeType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASLayoutRangeType.h; sourceTree = "<group>"; };
321323
292C599A1A956527007E5DD6 /* ASRangeHandlerPreload.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASRangeHandlerPreload.h; sourceTree = "<group>"; };
@@ -494,6 +496,7 @@
494496
056D21501ABCEDA1001107EF /* ASSnapshotTestCase.h */,
495497
05EA6FE61AC0966E00E35788 /* ASSnapshotTestCase.mm */,
496498
056D21541ABCEF50001107EF /* ASImageNodeSnapshotTests.m */,
499+
242995D21B29743C00090100 /* ASBasicImageDownloaderTests.m */,
497500
29CDC2E11AAE70D000833CA4 /* ASBasicImageDownloaderContextTests.m */,
498501
296A0A341A951ABF005ACEAA /* ASBatchFetchingTests.m */,
499502
2911485B1A77147A005D0878 /* ASControlNodeTests.m */,
@@ -958,6 +961,7 @@
958961
058D0A3E195D057000B7D73C /* ASTextNodeRendererTests.m in Sources */,
959962
058D0A3D195D057000B7D73C /* ASTextNodeCoreTextAdditionsTests.m in Sources */,
960963
058D0A3C195D057000B7D73C /* ASMutableAttributedStringBuilderTests.m in Sources */,
964+
242995D31B29743C00090100 /* ASBasicImageDownloaderTests.m in Sources */,
961965
058D0A3F195D057000B7D73C /* ASTextNodeShadowerTests.m in Sources */,
962966
29CDC2E21AAE70D000833CA4 /* ASBasicImageDownloaderContextTests.m in Sources */,
963967
056D21551ABCEF50001107EF /* ASImageNodeSnapshotTests.m in Sources */,

AsyncDisplayKit/Details/ASBasicImageDownloader.mm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ - (void)performProgressBlocks:(CGFloat)progress
115115
}
116116
}
117117

118-
- (void)completeWithImage:(CGImageRef)imageRef error:(NSError *)error
118+
- (void)completeWithImage:(UIImage *)image error:(NSError *)error
119119
{
120120
ASDN::MutexLocker l(_propertyLock);
121121
for (NSDictionary *callbackData in self.callbackDatas) {
@@ -124,7 +124,7 @@ - (void)completeWithImage:(CGImageRef)imageRef error:(NSError *)error
124124

125125
if (completionBlock) {
126126
dispatch_async(callbackQueue, ^{
127-
completionBlock(imageRef, error);
127+
completionBlock(image.CGImage, error);
128128
});
129129
}
130130
}
@@ -291,7 +291,7 @@ - (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTas
291291

292292
if (context) {
293293
UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:location]];
294-
[context completeWithImage:image.CGImage error:nil];
294+
[context completeWithImage:image error:nil];
295295
}
296296
}
297297

@@ -301,7 +301,7 @@ - (void)URLSession:(NSURLSession *)session task:(NSURLSessionDownloadTask *)task
301301
{
302302
ASBasicImageDownloaderContext *context = task.originalRequest.asyncdisplaykit_context;
303303
if (context && error) {
304-
[context completeWithImage:NULL error:error];
304+
[context completeWithImage:nil error:error];
305305
}
306306
}
307307

0 commit comments

Comments
 (0)