Commits
David B. Evans authored d75f0e1119e
1 + | From 2019b026decfdae8829b198eaf17762ff6a5cf13 Mon Sep 17 00:00:00 2001 |
2 + | From: Michael Catanzaro <mcatanzaro@igalia.com> |
3 + | Date: Sun, 2 Jul 2017 12:07:18 -0500 |
4 + | Subject: downloads-manager: Fix crash when download fails |
5 + | |
6 + | It's wrong to acquire the session inhibitor when destination is created, |
7 + | because the download could fail before that point, causing the |
8 + | inhibitotr to be released before it has been acquired and triggering our |
9 + | assertions to ensure this does not happen. |
10 + | |
11 + | Instead, acquire the inhibitor immediately when creating the download. |
12 + | |
13 + | https://bugzilla.gnome.org/show_bug.cgi?id=778653 |
14 + | --- |
15 + | embed/ephy-downloads-manager.c | 11 ++--------- |
16 + | 1 file changed, 2 insertions(+), 9 deletions(-) |
17 + | |
18 + | diff --git a/embed/ephy-downloads-manager.c b/embed/ephy-downloads-manager.c |
19 + | index a2c13c4..d61e168 100644 |
20 + | --- embed/ephy-downloads-manager.c |
21 + | +++ embed/ephy-downloads-manager.c |
22 + | |
23 + | g_signal_emit (manager, signals[ESTIMATED_PROGRESS_CHANGED], 0); |
24 + | } |
25 + | |
26 + | -static void |
27 + | -download_created_destination_cb (EphyDownloadsManager *manager) |
28 + | -{ |
29 + | - ephy_downloads_manager_acquire_session_inhibitor (manager); |
30 + | -} |
31 + | - |
32 + | void |
33 + | ephy_downloads_manager_add_download (EphyDownloadsManager *manager, |
34 + | EphyDownload *download) |
35 + | |
36 + | if (g_list_find (manager->downloads, download)) |
37 + | return; |
38 + | |
39 + | + ephy_downloads_manager_acquire_session_inhibitor (manager); |
40 + | + |
41 + | manager->downloads = g_list_prepend (manager->downloads, g_object_ref (download)); |
42 + | g_signal_connect (download, "completed", |
43 + | G_CALLBACK (download_completed_cb), |
44 + | |
45 + | g_signal_connect_swapped (wk_download, "notify::estimated-progress", |
46 + | G_CALLBACK (download_estimated_progress_changed_cb), |
47 + | manager); |
48 + | - g_signal_connect_swapped (wk_download, "created-destination", |
49 + | - G_CALLBACK (download_created_destination_cb), |
50 + | - manager); |
51 + | g_signal_emit (manager, signals[DOWNLOAD_ADDED], 0, download); |
52 + | g_signal_emit (manager, signals[ESTIMATED_PROGRESS_CHANGED], 0); |
53 + | } |
54 + | -- |
55 + | cgit v0.12 |
56 + | |