mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-27 05:04:27 +00:00
Fixes #230173 by removing partially downloaded files on download error.
Sparkle no longer leaks the NSURLDownload if the download fails.
This commit is contained in:
1 parent
7c709cb9fe
commit
49f717c1b1
1 file changed
+4
-3
@@ -110,7 +110,6 @@
|
||||
{
|
||||
// Okay, something's really broken with /tmp
|
||||
[download cancel];
|
||||
[download release]; download = nil;
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUTemporaryDirectoryError userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"Can't make a temporary directory for the update download at %@.",tempDir] forKey:NSLocalizedDescriptionKey]]];
|
||||
}
|
||||
|
||||
@@ -120,13 +119,14 @@
|
||||
|
||||
- (void)downloadDidFinish:(NSURLDownload *)d
|
||||
{
|
||||
[download release];
|
||||
download = nil;
|
||||
[self extractUpdate];
|
||||
}
|
||||
|
||||
- (void)download:(NSURLDownload *)download didFailWithError:(NSError *)error
|
||||
{
|
||||
// Get rid of what we've downloaded so far, if anything.
|
||||
if (downloadPath != nil)
|
||||
[[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceRecycleOperation source:[downloadPath stringByDeletingLastPathComponent] destination:@"" files:[NSArray arrayWithObject:[downloadPath lastPathComponent]] tag:NULL];
|
||||
[self abortUpdateWithError:error];
|
||||
}
|
||||
|
||||
@@ -213,6 +213,7 @@
|
||||
[hostBundle release];
|
||||
[downloadPath release];
|
||||
[unarchiver release];
|
||||
[download release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user