aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
Diffstat (limited to 'embed')
-rw-r--r--embed/mozilla/ProgressListener.cpp32
1 files changed, 21 insertions, 11 deletions
diff --git a/embed/mozilla/ProgressListener.cpp b/embed/mozilla/ProgressListener.cpp
index 039e9af40..bfd6c7d7d 100644
--- a/embed/mozilla/ProgressListener.cpp
+++ b/embed/mozilla/ProgressListener.cpp
@@ -64,7 +64,11 @@ GProgressListener::GProgressListener () : mLauncher(nsnull),
GProgressListener::~GProgressListener ()
{
- /* destructor code */
+ if (mDownloaderView)
+ {
+ g_object_remove_weak_pointer (G_OBJECT (mDownloaderView),
+ (void **) &mDownloaderView);
+ }
}
NS_METHOD GProgressListener::InitForPersist (nsIWebBrowserPersist *aPersist,
@@ -149,7 +153,7 @@ NS_METHOD GProgressListener::PrivateInit (void)
mElapsed = now - mStartTime;
- if (!mNoDialog)
+ if (!mNoDialog && mDownloaderView)
{
gchar *filename, *source, *dest;
nsAutoString uTmp;
@@ -179,6 +183,9 @@ NS_METHOD GProgressListener::PrivateInit (void)
G_CALLBACK (download_resume_cb),
this);
mDownloaderView = dv;
+
+ g_object_add_weak_pointer (G_OBJECT (mDownloaderView),
+ (void **) &mDownloaderView);
}
/* done */
@@ -513,15 +520,18 @@ NS_IMETHODIMP GProgressListener::
/currentRate +.5);
}
- downloader_view_set_download_progress (mDownloaderView,
- mElapsed,
- remaining,
- speed,
- totalKBytes,
- currentKBytes,
- progress,
- mCanPause,
- (gpointer)this);
+ if (mDownloaderView)
+ {
+ downloader_view_set_download_progress (mDownloaderView,
+ mElapsed,
+ remaining,
+ speed,
+ totalKBytes,
+ currentKBytes,
+ progress,
+ mCanPause,
+ (gpointer)this);
+ }
/* done */
return NS_OK;