[rhythmbox] task-list: ensure we don't expire tasks that have been removed
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] task-list: ensure we don't expire tasks that have been removed
- Date: Tue, 4 Mar 2014 12:19:26 +0000 (UTC)
commit fa1a2e8181b234aee8125287c06bf4a73b6cfa8c
Author: Jonathan Matthew <jonathan d14n org>
Date: Tue Mar 4 22:15:32 2014 +1000
task-list: ensure we don't expire tasks that have been removed
may or may not fix https://bugzilla.gnome.org/show_bug.cgi?id=724931
shell/rb-task-list.c | 29 ++++++++++++++++++-----------
1 files changed, 18 insertions(+), 11 deletions(-)
---
diff --git a/shell/rb-task-list.c b/shell/rb-task-list.c
index 85ce1d7..b3816ef 100644
--- a/shell/rb-task-list.c
+++ b/shell/rb-task-list.c
@@ -132,6 +132,22 @@ rb_task_list_class_init (RBTaskListClass *klass)
G_PARAM_READABLE));
}
+static void
+cancel_expiry (RBTaskList *list, RBTaskProgress *task)
+{
+ GList *l;
+ TaskExpiry *expiry;
+
+ for (l = list->expiring; l != NULL; l = l->next) {
+ expiry = l->data;
+ if (expiry->task == task) {
+ expiry->list->expiring = g_list_remove (expiry->list->expiring, expiry);
+ g_source_remove (expiry->expiry_id);
+ return;
+ }
+ }
+}
+
static gboolean
task_expired (TaskExpiry *expiry)
{
@@ -144,18 +160,8 @@ static void
expire_task (RBTaskList *list, RBTaskProgress *task, gint seconds)
{
TaskExpiry *expiry;
- GList *l;
-
- /* remove any existing expiry for this task */
- for (l = list->expiring; l != NULL; l = l->next) {
- expiry = l->data;
- if (expiry->task == task) {
- expiry->list->expiring = g_list_remove (expiry->list->expiring, expiry);
- g_source_remove (expiry->expiry_id);
- break;
- }
- }
+ cancel_expiry (list, task);
expiry = g_new0 (TaskExpiry, 1);
expiry->task = task;
expiry->list = list;
@@ -196,6 +202,7 @@ rb_task_list_add_task (RBTaskList *list, RBTaskProgress *task)
void
rb_task_list_remove_task (RBTaskList *list, RBTaskProgress *task)
{
+ cancel_expiry (list, task);
rb_list_model_remove_item (list->model, task);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]