[epiphany] downloads-manager: Fix crash when download fails
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] downloads-manager: Fix crash when download fails
- Date: Sun, 2 Jul 2017 17:09:22 +0000 (UTC)
commit b7e269f020145eac5d08316a678d9b7431d74cfa
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Sun Jul 2 12:07:18 2017 -0500
downloads-manager: Fix crash when download fails
It's wrong to acquire the session inhibitor when destination is created,
because the download could fail before that point, causing the
inhibitotr to be released before it has been acquired and triggering our
assertions to ensure this does not happen.
Instead, acquire the inhibitor immediately when creating the download.
https://bugzilla.gnome.org/show_bug.cgi?id=778653
embed/ephy-downloads-manager.c | 11 ++---------
1 files changed, 2 insertions(+), 9 deletions(-)
---
diff --git a/embed/ephy-downloads-manager.c b/embed/ephy-downloads-manager.c
index 1c166b6..3209a9a 100644
--- a/embed/ephy-downloads-manager.c
+++ b/embed/ephy-downloads-manager.c
@@ -159,12 +159,6 @@ download_estimated_progress_changed_cb (EphyDownloadsManager *manager)
g_signal_emit (manager, signals[ESTIMATED_PROGRESS_CHANGED], 0);
}
-static void
-download_created_destination_cb (EphyDownloadsManager *manager)
-{
- ephy_downloads_manager_acquire_session_inhibitor (manager);
-}
-
void
ephy_downloads_manager_add_download (EphyDownloadsManager *manager,
EphyDownload *download)
@@ -177,6 +171,8 @@ ephy_downloads_manager_add_download (EphyDownloadsManager *manager,
if (g_list_find (manager->downloads, download))
return;
+ ephy_downloads_manager_acquire_session_inhibitor (manager);
+
manager->downloads = g_list_prepend (manager->downloads, g_object_ref (download));
g_signal_connect (download, "completed",
G_CALLBACK (download_completed_cb),
@@ -189,9 +185,6 @@ ephy_downloads_manager_add_download (EphyDownloadsManager *manager,
g_signal_connect_swapped (wk_download, "notify::estimated-progress",
G_CALLBACK (download_estimated_progress_changed_cb),
manager);
- g_signal_connect_swapped (wk_download, "created-destination",
- G_CALLBACK (download_created_destination_cb),
- manager);
g_signal_emit (manager, signals[DOWNLOAD_ADDED], 0, download);
g_signal_emit (manager, signals[ESTIMATED_PROGRESS_CHANGED], 0);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]