mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Bug Fix - std::vector::erase
- Fixed bug whereby code called std::vector::erase, but then continued as though the iterator was still good.
This commit is contained in:
parent
108b486ac1
commit
858f34cf95
2 changed files with 11 additions and 4 deletions
|
@ -353,6 +353,7 @@ int TDB::gc ()
|
|||
|
||||
// Now move completed and deleted tasks from the pending list to the
|
||||
// completed list. Isn't garbage collection easy?
|
||||
std::vector <Task> still_pending;
|
||||
foreach (task, pending)
|
||||
{
|
||||
std::string st = task->get ("status");
|
||||
|
@ -361,11 +362,14 @@ int TDB::gc ()
|
|||
s == Task::deleted)
|
||||
{
|
||||
completed.push_back (*task);
|
||||
pending.erase (task);
|
||||
++count;
|
||||
}
|
||||
else
|
||||
still_pending.push_back (*task);
|
||||
}
|
||||
|
||||
pending = still_pending;
|
||||
|
||||
// No commit - all updates performed manually.
|
||||
if (count > 0)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue