[gnome-todo] task-list-view: don't keep iterating unnecessarily



commit 4aa0e241e01a682e074811b63c50fb84445e21f3
Author: djb <db0451 gmail com>
Date:   Wed Oct 26 23:23:25 2016 +0100

    task-list-view: don't keep iterating unnecessarily
    
    When removing a task, we would iterate the entire list of rows, even
    continuing after we found the task and removed it. A task should not
    occur more than once in a list, so we can exit early once it's found.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=773561

 src/gtd-task-list-view.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/gtd-task-list-view.c b/src/gtd-task-list-view.c
index 5801381..dde9b60 100644
--- a/src/gtd-task-list-view.c
+++ b/src/gtd-task-list-view.c
@@ -804,6 +804,8 @@ remove_task (GtdTaskListView *view,
                                                 task_completed_cb,
                                                 view);
           gtd_task_row_destroy (l->data);
+
+          break;
         }
     }
 
@@ -902,6 +904,8 @@ gtd_task_list_view__remove_row_for_task (GtdTaskListView *view,
           gtd_task_row_get_task (l->data) == task)
         {
           gtd_task_row_destroy (l->data);
+
+          break;
         }
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]