[epiphany/mcatanzaro/#1803] downloads-popover: fix hang when using Clear All button
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/mcatanzaro/#1803] downloads-popover: fix hang when using Clear All button
- Date: Fri, 3 Jun 2022 21:46:00 +0000 (UTC)
commit 24f98cbffff87b27b9fdcb0319c0be96d0da6078
Author: Michael Catanzaro <mcatanzaro redhat com>
Date: Fri Jun 3 16:44:34 2022 -0500
downloads-popover: fix hang when using Clear All button
If the Clear All button is pressed while a download is still active, we
loop forever because the loop's control condition just removes the first
item from the list and continues until all have been removed, but only
downloads that are not active get removed. We need to track how many
active downloads we have skipped to ensure we terminate.
Fixes #1803
lib/widgets/ephy-downloads-popover.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/lib/widgets/ephy-downloads-popover.c b/lib/widgets/ephy-downloads-popover.c
index 420b1edae..9624fcc22 100644
--- a/lib/widgets/ephy-downloads-popover.c
+++ b/lib/widgets/ephy-downloads-popover.c
@@ -123,20 +123,23 @@ clear_button_clicked_cb (EphyDownloadsPopover *popover)
{
EphyDownloadsManager *manager;
GtkListBoxRow *row;
+ int i = 0;
gtk_widget_hide (GTK_WIDGET (popover));
manager = ephy_embed_shell_get_downloads_manager (ephy_embed_shell_get_default ());
g_signal_handlers_block_by_func (manager, download_removed_cb, popover);
- while ((row = gtk_list_box_get_row_at_index (GTK_LIST_BOX (popover->downloads_box), 0))) {
+ while ((row = gtk_list_box_get_row_at_index (GTK_LIST_BOX (popover->downloads_box), i))) {
GtkWidget *widget;
EphyDownload *download;
widget = gtk_bin_get_child (GTK_BIN (row));
download = ephy_download_widget_get_download (EPHY_DOWNLOAD_WIDGET (widget));
- if (!ephy_download_is_active (download)) {
+ if (ephy_download_is_active (download)) {
+ i++;
+ } else {
ephy_downloads_manager_remove_download (manager, download);
gtk_container_remove (GTK_CONTAINER (popover->downloads_box), GTK_WIDGET (row));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]