summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpixel <pixel>2007-04-20 23:00:38 +0000
committerpixel <pixel>2007-04-20 23:00:38 +0000
commit9255fef52c78ad0fbc457af550e74ca679567773 (patch)
treea83d7de8a5813c5b9029a4d42a25267f553ad698
parentfef7f522d73c698edb1b5a7612b0d25c3c9fff9f (diff)
Microsoft's STL iterators are not behaving correctly. Fixing a bit the way we work with them.
-rw-r--r--lib/TaskMan.cc20
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;
}
}
}