diff options
Diffstat (limited to 'lib/TaskMan.cc')
-rw-r--r-- | lib/TaskMan.cc | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/TaskMan.cc b/lib/TaskMan.cc index 183b162..b31d2cd 100644 --- a/lib/TaskMan.cc +++ b/lib/TaskMan.cc @@ -351,7 +351,9 @@ void TaskMan::RemoveFromWatches(Task * t) { for (std::vector<w4ha_t>::iterator p = w4ha.begin(); p != w4ha.end(); p++) { if (p->T == t) { w4ha.erase(p); - p--; + p = w4ha.begin(); + if (w4ha.empty()) + break; } } } @@ -360,7 +362,9 @@ void TaskMan::RemoveFromWatches(Task * t) { for (std::vector<w4pr_t>::iterator p = w4pr.begin(); p != w4pr.end(); p++) { if (p->T == t) { w4pr.erase(p); - p--; + p = w4pr.begin(); + if (w4pr.empty()) + break; } } } @@ -369,7 +373,9 @@ void TaskMan::RemoveFromWatches(Task * t) { for (std::vector<w4to_t>::iterator p = w4to.begin(); p != w4to.end(); p++) { if (p->T == t) { w4to.erase(p); - p--; + p = w4to.begin(); + if (w4to.empty()) + break; } } } @@ -382,10 +388,14 @@ void TaskMan::RemoveFromWatches(Task * t) { TaskList.erase(p); number--; p = TaskList.begin(); + if (TaskList.empty()) + break; } else if ((*p) == t) { TaskList.erase(p); number--; p = TaskList.begin(); + if (TaskList.empty()) + break; } } } @@ -397,7 +407,9 @@ void TaskMan::RemoveTimeout(Task * t) { for (std::vector<w4to_t>::iterator p = w4to.begin(); p != w4to.end(); p++) { if (p->T == t) { w4to.erase(p); - p--; + p = w4to.begin(); + if (w4to.empty()) + break; } } } |