Index: trunk/MagicSoft/Mars/mbase/MContinue.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MContinue.cc	(revision 8618)
+++ trunk/MagicSoft/Mars/mbase/MContinue.cc	(revision 8642)
@@ -131,6 +131,6 @@
         }
 
-        *fLog << err << dbginf << "Unknown fatal Error! (fFilter=NULL?!?)" << endl;
-        return kFALSE;
+        *fLog << inf << "My filter has vanished... skipping." << endl;
+        return kSKIP;
     }
 
@@ -153,5 +153,5 @@
     if (!fTaskList->AddToListBefore(GetFilter(), this))
     {
-        *fLog << err << dbginf << "ERROR - Adding filter before MContinue... abort." << endl;
+        *fLog << err << dbginf << "ERROR - Adding filter before MContinue failed... abort." << endl;
         return kFALSE;
     }
Index: trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 8618)
+++ trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 8642)
@@ -102,5 +102,5 @@
 // default constructor
 //
-MEvtLoop::MEvtLoop(const char *name) : fParList(NULL), fProgress(NULL)
+MEvtLoop::MEvtLoop(const char *name) : fParList(NULL), fTaskList(NULL), fProgress(NULL)
 {
     fName = name;
@@ -1108,4 +1108,9 @@
 void MEvtLoop::RecursiveRemove(TObject *obj)
 {
+    // If the tasklist was deleted... remove it
+    if (obj==fTaskList)
+        fTaskList = NULL;
+
+    // If the parlist was deleted...invalidate par- and tasklist
     if (obj==fParList)
     {
@@ -1114,15 +1119,16 @@
     }
 
+    // if the progress bar was deleted...remove it
     if (obj==fProgress)
         fProgress = NULL;
 
-    if (obj==fDisplay)
-        SetDisplay(NULL);
-
-    if (obj==fLog)
-    {
-        if (fParList)
-            fParList->SetLogStream(NULL);
-        SetLogStream(NULL);
-    }
-}
+    // If it was something else check par- and tasklist
+    if (fParList)
+        fParList->RecursiveRemove(obj);
+    else
+        if (fTaskList) // Note that the tasklist is included in the parlist
+            fTaskList->RecursiveRemove(obj);
+
+    // Now check for fDisplay and fLog
+    MParContainer::RecursiveRemove(obj);
+}
Index: trunk/MagicSoft/Mars/mbase/MParContainer.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParContainer.cc	(revision 8618)
+++ trunk/MagicSoft/Mars/mbase/MParContainer.cc	(revision 8642)
@@ -71,4 +71,6 @@
 #include "MLogManip.h"
 
+#include "MStatusDisplay.h"
+
 TList *gListOfPrimitives; // forard declaration in MParContainer.h
 
@@ -116,5 +118,5 @@
         return;
 
-    *fLog << all << "Deleting " << GetDescriptor() << endl;
+    *fLog << all << "Deleting " << this << " " << GetDescriptor() << endl;
     if (TestBit(kMustCleanup) && gROOT && gROOT->MustClean())
     {
@@ -921,2 +923,26 @@
     return ((TEnv&)env).GetValue(prefix, dflt);
 }
+
+// --------------------------------------------------------------------------
+//
+// If object to remove is fDisplay set fDisplay to NULL.
+// If object to remove is fLog     set fLog     to NULL.
+// Call TObject::RecursiveRemove
+//
+void MParContainer::RecursiveRemove(TObject *obj)
+{
+    if (obj==fDisplay)
+        fDisplay=NULL;
+
+    if (obj==fLog)
+        fLog=NULL;
+
+    if (fDisplay)
+        fDisplay->RecursiveRemove(obj);
+
+    if (fLog)
+        fLog->RecursiveRemove(obj);
+
+    TObject::RecursiveRemove(obj);
+}
+
Index: trunk/MagicSoft/Mars/mbase/MParContainer.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParContainer.h	(revision 8618)
+++ trunk/MagicSoft/Mars/mbase/MParContainer.h	(revision 8642)
@@ -146,4 +146,6 @@
     MParContainer *GetNewObject(const char *name, TClass *base=MParContainer::Class()) const;
 
+    void RecursiveRemove(TObject *obj);
+
     ClassDef(MParContainer, 0)  //The basis for all parameter containers
 };
Index: trunk/MagicSoft/Mars/mbase/MParList.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParList.cc	(revision 8618)
+++ trunk/MagicSoft/Mars/mbase/MParList.cc	(revision 8642)
@@ -312,14 +312,33 @@
 
     TObject *obj = fContainer->Remove(cont);
-    if (!obj)
-    {
-        *fLog << warn << "Object not found in list..." << endl;
-        return;
-    }
-
-    *fLog << inf << "MParContainer '" << cont->GetName() << "' removed..." << endl;
-
-    if (IsOwner() && !fAutodelete->FindObject(obj))
+
+    fContainer->RecursiveRemove(obj);
+
+    // if (!obj)
+    // {
+        //        *fLog << warn << "Object not found in list..." << endl;
+    //    return;
+    //}
+
+//    *fLog << inf << "MParContainer '" << cont->GetName() << "' removed..." << endl;
+
+    if (obj && IsOwner() && !fAutodelete->FindObject(obj))
         delete obj;
+}
+
+// --------------------------------------------------------------------------
+//
+// Call MParContainer::RecursiveRemove
+// Call fContainer->RecursiveRemove
+//
+void MParList::RecursiveRemove(TObject *obj)
+{
+    MParContainer::RecursiveRemove(obj);
+
+    if (obj==fContainer)
+        fContainer = NULL;
+
+    if (fContainer)
+        fContainer->RecursiveRemove(obj);
 }
 
Index: trunk/MagicSoft/Mars/mbase/MParList.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParList.h	(revision 8618)
+++ trunk/MagicSoft/Mars/mbase/MParList.h	(revision 8642)
@@ -86,4 +86,6 @@
     }
 
+    void RecursiveRemove(TObject *obj);
+
     void Reset();
     void SetReadyToSave(Bool_t flag=kTRUE);
Index: trunk/MagicSoft/Mars/mbase/MStatusDisplay.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MStatusDisplay.h	(revision 8618)
+++ trunk/MagicSoft/Mars/mbase/MStatusDisplay.h	(revision 8642)
@@ -66,5 +66,7 @@
         kPicMagic, kPicMars,
         // kGui
-        kSearch, kTabs
+        kSearch, kTabs,
+        // kLastElement
+        kLastElement
     } Status_t;
 
Index: trunk/MagicSoft/Mars/mbase/MTask.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTask.cc	(revision 8618)
+++ trunk/MagicSoft/Mars/mbase/MTask.cc	(revision 8642)
@@ -147,6 +147,9 @@
 {
     fFilter=filter;
-    if (filter)
-        AddToBranchList(filter->GetDataMember());
+    if (!filter)
+        return;
+
+    fFilter->SetBit(kMustCleanup);    // Better is better ;-)
+    AddToBranchList(filter->GetDataMember());
 }
 
@@ -557,2 +560,18 @@
     *fLog << "%) Evts skipped: " << str << endl;
 }
+
+// --------------------------------------------------------------------------
+//
+// If obj==fFilter set fFilter to NULL
+// Call MParcontainer::RecursiveRemove
+//
+void MTask::RecursiveRemove(TObject *obj)
+{
+    if (obj==fFilter)
+        fFilter=NULL;
+
+    if (fFilter)
+        fFilter->RecursiveRemove(obj);
+
+    MParContainer::RecursiveRemove(obj);
+}
Index: trunk/MagicSoft/Mars/mbase/MTask.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTask.h	(revision 8618)
+++ trunk/MagicSoft/Mars/mbase/MTask.h	(revision 8642)
@@ -123,4 +123,7 @@
     void SavePrimitive(ofstream &out, Option_t *o="");
 
+    // TObject
+    void RecursiveRemove(TObject *obj);
+
     ClassDef(MTask, 2) //Abstract base class for a task
 };
Index: trunk/MagicSoft/Mars/mbase/MTaskList.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 8618)
+++ trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 8642)
@@ -18,5 +18,5 @@
 !   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2004
+!   Copyright: MAGIC Software Development, 2000-2007
 !
 !
@@ -80,4 +80,7 @@
 using namespace std;
 
+//#define DEBUG_PROCESS
+#undef DEBUG_PROCESS
+
 const TString MTaskList::gsDefName  = "MTaskList";
 const TString MTaskList::gsDefTitle = "A list for tasks to be executed";
@@ -89,5 +92,5 @@
 // this name in the parameter list (by MEvtLoop::SetParList)
 //
-MTaskList::MTaskList(const char *name, const char *title) : fNumPasses(0), fNumPass(0)
+MTaskList::MTaskList(const char *name, const char *title) : fTasks(0), fParList(0), fNumPasses(0), fNumPass(0)
 {
     fName  = name  ? name  : gsDefName.Data();
@@ -465,8 +468,37 @@
 void MTaskList::Remove(MTask *task)
 {
+    if (!task)
+        return;
+
+    // First remove it from the list(s) so that a later RecursiveRemove
+    // cannot fint the task again
     TObject *obj = fTasks->Remove(task);
 
-    if (TestBit(kIsOwner))
+    // Now do a recursive remove on all other tasks.
+    fTasks->RecursiveRemove(task);
+
+    if (obj && TestBit(kIsOwner))
         delete obj;
+}
+
+// --------------------------------------------------------------------------
+//
+// Call MTask::RecursiveRemove
+// Call fTasks->RecursiveRemove
+//
+void MTaskList::RecursiveRemove(TObject *obj)
+{
+    MTask::RecursiveRemove(obj);
+
+    if (obj==fTasks)
+        fTasks=NULL;
+
+    if (fTasks)
+    {
+        fTasks->RecursiveRemove(obj);
+
+        // In theory this call is obsolete
+        fTasksProcess.RecursiveRemove(obj);
+    }
 }
 
@@ -620,4 +652,8 @@
     MTask *task=NULL;
 
+#ifdef DEBUG_PROCESS
+    *fLog << all << "ProcessTaskList - " << GetDescriptor() << " - start." << endl;
+#endif
+
     //
     // loop over all tasks for processing
@@ -626,4 +662,8 @@
     while ( (task=(MTask*)Next()) )
     {
+#ifdef DEBUG_PROCESS
+        *fLog << all << "Process - " << (void*)task << " " << flush;
+        *fLog << task->GetDescriptor() << "... " << flush;
+#endif
         //
         // if the task has the wrong stream id skip it.
@@ -646,4 +686,7 @@
             // everything was OK: go on with the next task
             //
+#ifdef DEBUG_PROCESS
+            *fLog << "true." << endl;
+#endif
             continue;
 
@@ -668,4 +711,7 @@
             // something occured: skip the rest of the tasks for this event
             //
+#ifdef DEBUG_PROCESS
+            *fLog << "continue." << endl;
+#endif
             rc = kCONTINUE;
             break;
@@ -677,4 +723,8 @@
         break;
     }
+
+#ifdef DEBUG_PROCESS
+    *fLog << all << "ProcessTaskList - " << GetDescriptor() << " - done." << endl;
+#endif
 
     return rc;
Index: trunk/MagicSoft/Mars/mbase/MTaskList.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTaskList.h	(revision 8618)
+++ trunk/MagicSoft/Mars/mbase/MTaskList.h	(revision 8642)
@@ -97,4 +97,6 @@
     Bool_t WriteEnv(TEnv &env, TString prefix, Bool_t print=kFALSE) const;
 
+    void   RecursiveRemove(TObject *obj);
+
     operator TIterator*() const;
 
