Replace -cleanupWithCompletion: with just a -cleanup

SUPersistentDownloader doesn't implement -dealloc anymore so there shouldn't be issues
This commit is contained in:
Zorg committed 2016-08-20 09:46:42 -04:00
1 parent ab44d58d0e
commit 9ac76d6253
3 files changed
+9 -23

No files matched your search

@@ -77,14 +77,6 @@ static NSString *SUPersistentDownloadingReason = @"Downloading persistent file";
self.delegate = nil;
}
- (void)cleanupWithCompletion:(void (^)(void))completionBlock
{
dispatch_async(dispatch_get_main_queue(), ^{
[self cleanup];
completionBlock();
});
}
- (void)download:(NSURLDownload *)__unused d decideDestinationWithSuggestedFilename:(NSString *)name
{
// Remove our old caches path so we don't start accumulating files in there
@@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)startDownloadWithRequest:(SPUURLRequest *)request bundleIdentifier:(NSString *)bundleIdentifier desiredFilename:(NSString *)desiredFilename;
- (void)cleanupWithCompletion:(void (^)(void))completionBlock;
- (void)cleanup;
@end
+8 -14
View File
@@ -123,22 +123,16 @@
- (void)cleanup
{
// It's very crucial to wait until they are done with completion before invalidating our XPC connection (if there is one)
// Otherwise we can run into some unfortunate crashes
// Edit: I think this was an issue because -dealloc was implemented to invoke this method. I have since removed -dealloc
// Will have to test around with this later
self.cleaningUp = YES;
[self.downloader cleanupWithCompletion:^{
dispatch_async(dispatch_get_main_queue(), ^{
if (self.connection != nil) {
[self.connection invalidate];
self.connection = nil;
}
self.downloadName = nil;
self.downloader = nil;
});
}];
[self.downloader cleanup];
if (self.connection != nil) {
[self.connection invalidate];
self.connection = nil;
}
self.downloadName = nil;
self.downloader = nil;
}
- (void)downloaderDidFinishDownloading