diff options
| -rw-r--r-- | include/Task.h | 1 | ||||
| -rw-r--r-- | lib/Task.cc | 4 | ||||
| -rw-r--r-- | lib/TaskMan.cc | 12 | 
3 files changed, 16 insertions, 1 deletions
| diff --git a/include/Task.h b/include/Task.h index e7ad1c9..b4d8b68 100644 --- a/include/Task.h +++ b/include/Task.h @@ -33,6 +33,7 @@ class Task : public Base {      void Stop();      void Restart();      bool IsStopped(); +    void RemoveFromWatches();    protected:      virtual int Do() throw (GeneralException); diff --git a/lib/Task.cc b/lib/Task.cc index 2c8f048..c50a6e7 100644 --- a/lib/Task.cc +++ b/lib/Task.cc @@ -84,3 +84,7 @@ bool Task::IsStopped() {  Task * Task::WaitedBy() {      return wbta;  } + +void Task::RemoveFromWatches() { +    wbta = 0; +} diff --git a/lib/TaskMan.cc b/lib/TaskMan.cc index 5b29d1c..c688f8a 100644 --- a/lib/TaskMan.cc +++ b/lib/TaskMan.cc @@ -115,6 +115,16 @@ void TaskMan::RemoveFromWatches(Task * t) {  	    p--;  	}      } +     +    for (TaskList_t::iterator p = TaskList.begin(); p && (p != TaskList.end()); p++) { +	if ((*p)->WaitedBy() == t) { +	    Zombies.push_back(*p); +	    (*p)->RemoveFromWatches(); +	    TaskList.erase(p); +	    number--; +	    p--; +	} +    }  }  void TaskMan::WaitFor(Handle * h, Task * t, int flags) { @@ -328,7 +338,7 @@ void TaskMan::MainLoop() throw (GeneralException) {  		    if (o->GetState() == TASK_DONE) {  			TaskList_t::iterator f = FindTask(o);  			if (!f) { -			    throw GeneralException(_("TaskMan: internal error (task not found)")); +			    throw GeneralException(_("TaskMan: internal error (task not found) -- SHOULD NOT HAPPEN!!"));  			}  			TaskList.erase(f);  			number--; | 
