aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Escalante Urrelo <descalante@igalia.com>2010-03-11 08:20:01 +0800
committerDiego Escalante Urrelo <descalante@igalia.com>2010-03-16 07:29:58 +0800
commit50cd4276088499093b428b54195a88c4b7a1a0ad (patch)
treed7fdd76f949ca99c246c6aa56cb1a5cb669454cb
parent061f31953d1d4a6b18b7ac434f0520e65249b9e1 (diff)
downloadgsoc2013-epiphany-50cd4276088499093b428b54195a88c4b7a1a0ad.tar
gsoc2013-epiphany-50cd4276088499093b428b54195a88c4b7a1a0ad.tar.gz
gsoc2013-epiphany-50cd4276088499093b428b54195a88c4b7a1a0ad.tar.bz2
gsoc2013-epiphany-50cd4276088499093b428b54195a88c4b7a1a0ad.tar.lz
gsoc2013-epiphany-50cd4276088499093b428b54195a88c4b7a1a0ad.tar.xz
gsoc2013-epiphany-50cd4276088499093b428b54195a88c4b7a1a0ad.tar.zst
gsoc2013-epiphany-50cd4276088499093b428b54195a88c4b7a1a0ad.zip
downloader-view: use update_download_row correctly on add
When adding a download we should call update_download_row() *after* connecting the signal handlers or they will never be disconnected. Also, in update_download_row() we should consider that the case where it is called with a download that has already been removed as a non fatal case (i.e. just return;). This is because in downloader_view_add_download() we can have the signal handlers remove the download from the view before the manual call (it was happening vice versa before this).
-rw-r--r--embed/downloader-view.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/embed/downloader-view.c b/embed/downloader-view.c
index 846938749..7fbb1e54b 100644
--- a/embed/downloader-view.c
+++ b/embed/downloader-view.c
@@ -482,7 +482,12 @@ update_download_row (DownloaderView *dv, WebKitDownload *download)
#endif
row_ref = get_row_from_download (dv, download);
- g_return_if_fail (row_ref != NULL);
+ /* In downloader_view_add_download() we call this function manually to
+ * ensure the view has something visible in the tree view, however
+ * signal handlers might have already removed this download from the
+ * DV, this is that case. */
+ if (row_ref == NULL)
+ return;
/* Status special casing */
status = webkit_download_get_status (download);
@@ -698,7 +703,6 @@ downloader_view_add_download (DownloaderView *dv,
download,
row_ref);
- update_download_row (dv, download);
update_status_icon (dv);
selection = gtk_tree_view_get_selection
@@ -715,6 +719,8 @@ downloader_view_add_download (DownloaderView *dv,
g_signal_connect_object (download, "error",
G_CALLBACK (download_error_cb), dv, 0);
+ update_download_row (dv, download);
+
/* Show it already */
g_object_get (G_OBJECT (dv->priv->window), "visible", &visible, NULL);