Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 1279)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 1280)
@@ -1,3 +1,12 @@
                                                                   -*-*- END -*-*-
+
+ 2002/04/19: Thomas Bretz
+
+   * mbase/MTaskList.cc:
+     - fixed a heavy bug which caused PreProcess to crash (GetListOfBases
+       return a List of TBaseClasses not a List of TClass objects)
+     - added a security check to Process whether we have something to process or not.
+
+
 
  2002/04/17: Thomas Bretz
Index: /trunk/MagicSoft/Mars/mbase/MTaskList.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 1279)
+++ /trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 1280)
@@ -261,4 +261,6 @@
 //  do pre processing (before eventloop) of all tasks in the task-list
 //
+#include <TMethod.h>
+#include <TBaseClass.h>
 Bool_t MTaskList::PreProcess(MParList *pList)
 { 
@@ -283,12 +285,19 @@
         *fLog << all << task->GetName() << "... " << flush;
 
-        TClass *cls=NULL;
+        //
+        // Check whether this task (or one of it's base classes) overloads
+        // MTask::Process. Only if this function is overloaded this task is
+        // added to the fTaskProcess-List. This makes the execution of the
+        // tasklist a little bit (only a little bit) faster, bacause tasks
+        // doing no Processing are not Processed.
+        //
+        TBaseClass *cls=NULL;
         TIter NextBase(task->IsA()->GetListOfBases());
-        while ((cls=(TClass*)NextBase()))
+        while ((cls=(TBaseClass*)NextBase()))
         {
             if (cls->GetName()=="MTask")
                 break;
 
-            if (!cls->GetMethodAny("Process"))
+            if (!cls->GetClassPointer()->GetMethodAny("Process"))
                 continue;
 
@@ -297,4 +306,7 @@
         }
 
+        //
+        // PreProcess the task and check for it's return value.
+        //
         switch (task->CallPreProcess(fParList))
         {
@@ -326,4 +338,14 @@
 Bool_t MTaskList::Process()
 {
+    //
+    // Check whether there is something which can be processed, otherwise
+    // stop the eventloop.
+    //
+    if (fTasksProcess.GetSize()==0)
+    {
+        *fLog << warn << "Warning: No entries in " << GetDescriptor() << " for Processing." << endl;
+        return kFALSE;
+    }
+
     //
     // Reset the ReadyToSave flag.
@@ -385,4 +407,5 @@
         }
     }
+
     return kTRUE;
 }
