When quitting, the d/l progress window and controller are shut down
before the d/l listener. add some code to separate the two and a kung-fu death grip around the timer code to clean up this case (bug 161218) git-svn-id: svn://10.0.0.236/trunk@126686 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -149,6 +149,7 @@ public:
|
||||
virtual void ResumeDownload() = 0;
|
||||
virtual void CancelDownload() = 0;
|
||||
virtual void DownloadDone() = 0;
|
||||
virtual void DetachDownloadDisplay() = 0; // tell downloader to forget about its display
|
||||
|
||||
virtual void CreateDownloadDisplay();
|
||||
|
||||
|
||||
@@ -82,6 +82,11 @@ static NSString *ProgressWindowFrameSaveName = @"ProgressWindow";
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
// if we get here because we're quitting, the listener will still be alive
|
||||
// yet we're going away. As a result, we need to tell the d/l listener to
|
||||
// forget it ever met us and necko will clean it up on its own.
|
||||
if ( mDownloader)
|
||||
mDownloader->DetachDownloadDisplay();
|
||||
NS_IF_RELEASE(mDownloader);
|
||||
[super dealloc];
|
||||
}
|
||||
@@ -486,8 +491,15 @@ static NSString *ProgressWindowFrameSaveName = @"ProgressWindow";
|
||||
|
||||
- (void)onEndDownload
|
||||
{
|
||||
[self killDownloadTimer];
|
||||
[self setDownloadProgress:nil];
|
||||
// if we're quitting, our progress window is already gone and we're in the
|
||||
// process of shutting down gecko and all the d/l listeners. The timer, at
|
||||
// that point, is the only thing keeping us alive. Killing it will cause
|
||||
// us to go away immediately, so kung-fu deathgrip it until we're done twiddling
|
||||
// bits on ourself.
|
||||
[self retain]; // Enter The Dragon!
|
||||
[self killDownloadTimer];
|
||||
[self setDownloadProgress:nil];
|
||||
[self release];
|
||||
}
|
||||
|
||||
- (void)setProgressTo:(long)aCurProgress ofMax:(long)aMaxProgress
|
||||
|
||||
@@ -73,6 +73,7 @@ public:
|
||||
virtual void ResumeDownload();
|
||||
virtual void CancelDownload();
|
||||
virtual void DownloadDone();
|
||||
virtual void DetachDownloadDisplay();
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -307,4 +307,17 @@ nsDownloadListener::DownloadDone()
|
||||
[mDownloadDisplay onEndDownload];
|
||||
}
|
||||
|
||||
//
|
||||
// DetachDownloadDisplay
|
||||
//
|
||||
// there are times when the download dislpay UI goes away before the
|
||||
// listener (quit, for example). This alerts us that we should forget all
|
||||
// about having any UI.
|
||||
//
|
||||
void
|
||||
nsDownloadListener::DetachDownloadDisplay()
|
||||
{
|
||||
mDownloadDisplay = nil;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@@ -82,6 +82,11 @@ static NSString *ProgressWindowFrameSaveName = @"ProgressWindow";
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
// if we get here because we're quitting, the listener will still be alive
|
||||
// yet we're going away. As a result, we need to tell the d/l listener to
|
||||
// forget it ever met us and necko will clean it up on its own.
|
||||
if ( mDownloader)
|
||||
mDownloader->DetachDownloadDisplay();
|
||||
NS_IF_RELEASE(mDownloader);
|
||||
[super dealloc];
|
||||
}
|
||||
@@ -486,8 +491,15 @@ static NSString *ProgressWindowFrameSaveName = @"ProgressWindow";
|
||||
|
||||
- (void)onEndDownload
|
||||
{
|
||||
[self killDownloadTimer];
|
||||
[self setDownloadProgress:nil];
|
||||
// if we're quitting, our progress window is already gone and we're in the
|
||||
// process of shutting down gecko and all the d/l listeners. The timer, at
|
||||
// that point, is the only thing keeping us alive. Killing it will cause
|
||||
// us to go away immediately, so kung-fu deathgrip it until we're done twiddling
|
||||
// bits on ourself.
|
||||
[self retain]; // Enter The Dragon!
|
||||
[self killDownloadTimer];
|
||||
[self setDownloadProgress:nil];
|
||||
[self release];
|
||||
}
|
||||
|
||||
- (void)setProgressTo:(long)aCurProgress ofMax:(long)aMaxProgress
|
||||
|
||||
@@ -73,6 +73,7 @@ public:
|
||||
virtual void ResumeDownload();
|
||||
virtual void CancelDownload();
|
||||
virtual void DownloadDone();
|
||||
virtual void DetachDownloadDisplay();
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -307,4 +307,17 @@ nsDownloadListener::DownloadDone()
|
||||
[mDownloadDisplay onEndDownload];
|
||||
}
|
||||
|
||||
//
|
||||
// DetachDownloadDisplay
|
||||
//
|
||||
// there are times when the download dislpay UI goes away before the
|
||||
// listener (quit, for example). This alerts us that we should forget all
|
||||
// about having any UI.
|
||||
//
|
||||
void
|
||||
nsDownloadListener::DetachDownloadDisplay()
|
||||
{
|
||||
mDownloadDisplay = nil;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@@ -149,6 +149,7 @@ public:
|
||||
virtual void ResumeDownload() = 0;
|
||||
virtual void CancelDownload() = 0;
|
||||
virtual void DownloadDone() = 0;
|
||||
virtual void DetachDownloadDisplay() = 0; // tell downloader to forget about its display
|
||||
|
||||
virtual void CreateDownloadDisplay();
|
||||
|
||||
|
||||
@@ -149,6 +149,7 @@ public:
|
||||
virtual void ResumeDownload() = 0;
|
||||
virtual void CancelDownload() = 0;
|
||||
virtual void DownloadDone() = 0;
|
||||
virtual void DetachDownloadDisplay() = 0; // tell downloader to forget about its display
|
||||
|
||||
virtual void CreateDownloadDisplay();
|
||||
|
||||
|
||||
@@ -82,6 +82,11 @@ static NSString *ProgressWindowFrameSaveName = @"ProgressWindow";
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
// if we get here because we're quitting, the listener will still be alive
|
||||
// yet we're going away. As a result, we need to tell the d/l listener to
|
||||
// forget it ever met us and necko will clean it up on its own.
|
||||
if ( mDownloader)
|
||||
mDownloader->DetachDownloadDisplay();
|
||||
NS_IF_RELEASE(mDownloader);
|
||||
[super dealloc];
|
||||
}
|
||||
@@ -486,8 +491,15 @@ static NSString *ProgressWindowFrameSaveName = @"ProgressWindow";
|
||||
|
||||
- (void)onEndDownload
|
||||
{
|
||||
[self killDownloadTimer];
|
||||
[self setDownloadProgress:nil];
|
||||
// if we're quitting, our progress window is already gone and we're in the
|
||||
// process of shutting down gecko and all the d/l listeners. The timer, at
|
||||
// that point, is the only thing keeping us alive. Killing it will cause
|
||||
// us to go away immediately, so kung-fu deathgrip it until we're done twiddling
|
||||
// bits on ourself.
|
||||
[self retain]; // Enter The Dragon!
|
||||
[self killDownloadTimer];
|
||||
[self setDownloadProgress:nil];
|
||||
[self release];
|
||||
}
|
||||
|
||||
- (void)setProgressTo:(long)aCurProgress ofMax:(long)aMaxProgress
|
||||
|
||||
@@ -73,6 +73,7 @@ public:
|
||||
virtual void ResumeDownload();
|
||||
virtual void CancelDownload();
|
||||
virtual void DownloadDone();
|
||||
virtual void DetachDownloadDisplay();
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -307,4 +307,17 @@ nsDownloadListener::DownloadDone()
|
||||
[mDownloadDisplay onEndDownload];
|
||||
}
|
||||
|
||||
//
|
||||
// DetachDownloadDisplay
|
||||
//
|
||||
// there are times when the download dislpay UI goes away before the
|
||||
// listener (quit, for example). This alerts us that we should forget all
|
||||
// about having any UI.
|
||||
//
|
||||
void
|
||||
nsDownloadListener::DetachDownloadDisplay()
|
||||
{
|
||||
mDownloadDisplay = nil;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@@ -82,6 +82,11 @@ static NSString *ProgressWindowFrameSaveName = @"ProgressWindow";
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
// if we get here because we're quitting, the listener will still be alive
|
||||
// yet we're going away. As a result, we need to tell the d/l listener to
|
||||
// forget it ever met us and necko will clean it up on its own.
|
||||
if ( mDownloader)
|
||||
mDownloader->DetachDownloadDisplay();
|
||||
NS_IF_RELEASE(mDownloader);
|
||||
[super dealloc];
|
||||
}
|
||||
@@ -486,8 +491,15 @@ static NSString *ProgressWindowFrameSaveName = @"ProgressWindow";
|
||||
|
||||
- (void)onEndDownload
|
||||
{
|
||||
[self killDownloadTimer];
|
||||
[self setDownloadProgress:nil];
|
||||
// if we're quitting, our progress window is already gone and we're in the
|
||||
// process of shutting down gecko and all the d/l listeners. The timer, at
|
||||
// that point, is the only thing keeping us alive. Killing it will cause
|
||||
// us to go away immediately, so kung-fu deathgrip it until we're done twiddling
|
||||
// bits on ourself.
|
||||
[self retain]; // Enter The Dragon!
|
||||
[self killDownloadTimer];
|
||||
[self setDownloadProgress:nil];
|
||||
[self release];
|
||||
}
|
||||
|
||||
- (void)setProgressTo:(long)aCurProgress ofMax:(long)aMaxProgress
|
||||
|
||||
@@ -73,6 +73,7 @@ public:
|
||||
virtual void ResumeDownload();
|
||||
virtual void CancelDownload();
|
||||
virtual void DownloadDone();
|
||||
virtual void DetachDownloadDisplay();
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -307,4 +307,17 @@ nsDownloadListener::DownloadDone()
|
||||
[mDownloadDisplay onEndDownload];
|
||||
}
|
||||
|
||||
//
|
||||
// DetachDownloadDisplay
|
||||
//
|
||||
// there are times when the download dislpay UI goes away before the
|
||||
// listener (quit, for example). This alerts us that we should forget all
|
||||
// about having any UI.
|
||||
//
|
||||
void
|
||||
nsDownloadListener::DetachDownloadDisplay()
|
||||
{
|
||||
mDownloadDisplay = nil;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@@ -149,6 +149,7 @@ public:
|
||||
virtual void ResumeDownload() = 0;
|
||||
virtual void CancelDownload() = 0;
|
||||
virtual void DownloadDone() = 0;
|
||||
virtual void DetachDownloadDisplay() = 0; // tell downloader to forget about its display
|
||||
|
||||
virtual void CreateDownloadDisplay();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user