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:
pinkerton%netscape.com
2002-08-07 21:32:02 +00:00
parent 04ad40d2b9
commit 4bd4ffd203
16 changed files with 116 additions and 8 deletions

View File

@@ -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();

View File

@@ -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

View File

@@ -73,6 +73,7 @@ public:
virtual void ResumeDownload();
virtual void CancelDownload();
virtual void DownloadDone();
virtual void DetachDownloadDisplay();
private:

View File

@@ -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 -

View File

@@ -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

View File

@@ -73,6 +73,7 @@ public:
virtual void ResumeDownload();
virtual void CancelDownload();
virtual void DownloadDone();
virtual void DetachDownloadDisplay();
private:

View File

@@ -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 -

View File

@@ -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();

View File

@@ -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();

View File

@@ -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

View File

@@ -73,6 +73,7 @@ public:
virtual void ResumeDownload();
virtual void CancelDownload();
virtual void DownloadDone();
virtual void DetachDownloadDisplay();
private:

View File

@@ -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 -

View File

@@ -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

View File

@@ -73,6 +73,7 @@ public:
virtual void ResumeDownload();
virtual void CancelDownload();
virtual void DownloadDone();
virtual void DetachDownloadDisplay();
private:

View File

@@ -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 -

View File

@@ -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();