diff --git a/mozilla/camino/src/download/ProgressDlgController.mm b/mozilla/camino/src/download/ProgressDlgController.mm index 8f229235690..8aa92e1c27d 100644 --- a/mozilla/camino/src/download/ProgressDlgController.mm +++ b/mozilla/camino/src/download/ProgressDlgController.mm @@ -649,6 +649,10 @@ static id gSharedProgressController = nil; -(void)removeDownload:(id )progressDisplay suppressRedraw:(BOOL)suppressRedraw { [progressDisplay displayWillBeRemoved]; + // This is sometimes called by code that thinks it can continue + // to use |progressDisplay|. Extended the lifetime slightly as a + // band-aid, but this logic should really be reworked. + [[progressDisplay retain] autorelease]; [mProgressViewControllers removeObject:progressDisplay]; if ([mProgressViewControllers count] == 0) { diff --git a/mozilla/camino/src/download/ProgressViewController.mm b/mozilla/camino/src/download/ProgressViewController.mm index 128f2d82d29..77a24bb22ff 100644 --- a/mozilla/camino/src/download/ProgressViewController.mm +++ b/mozilla/camino/src/download/ProgressViewController.mm @@ -67,7 +67,7 @@ enum { -(void)refreshDownloadInfo; -(void)launchFileIfAppropriate; -(void)setProgressViewFromDictionary:(NSDictionary*)aDict; --(void)removeFromDownloadListIfAppropriate; +-(BOOL)shouldRemoveFromDownloadList; @end @@ -366,7 +366,10 @@ enum { [self refreshDownloadInfo]; [self launchFileIfAppropriate]; - [self removeFromDownloadListIfAppropriate]; + if ([self shouldRemoveFromDownloadList]) + [mProgressWindowController removeDownload:self suppressRedraw:NO]; + else if (!mDownloadFailed) + [self setupFileSystemNotification]; } } @@ -379,14 +382,13 @@ enum { } } -// Remove the download from the view if the pref is set to remove upon successful download --(void)removeFromDownloadListIfAppropriate +-(BOOL)shouldRemoveFromDownloadList { + if (![self hasSucceeded]) + return NO; int downloadRemoveActionValue = [[PreferenceManager sharedInstance] getIntPref:"browser.download.downloadRemoveAction" withSuccess:NULL]; - - if (!mUserCancelled && !mDownloadFailed && downloadRemoveActionValue == kRemoveUponSuccessfulDownloadPrefValue) - [mProgressWindowController removeDownload:self suppressRedraw:NO]; + return (downloadRemoveActionValue == kRemoveUponSuccessfulDownloadPrefValue); } // this handles lots of things - all of the status updates @@ -687,8 +689,6 @@ enum { [self downloadDidEnd]; [mProgressWindowController didEndDownload:self withSuccess:completedOK statusCode:aStatus]; - if (completedOK) - [self setupFileSystemNotification]; } -(void)setProgressTo:(long long)aCurProgress ofMax:(long long)aMaxProgress