mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-30 05:28:50 +00:00
Replace -cleanupWithCompletion: with just a -cleanup
SUPersistentDownloader doesn't implement -dealloc anymore so there shouldn't be issues
This commit is contained in:
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
|
||||
|
||||
|
||||
Vendored
+8
-14
@@ -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
|
||||
|
||||
Reference in new issue
Block a user