Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 893)
+++ trunk/MagicSoft/Mars/Changelog	(revision 894)
@@ -10,4 +10,9 @@
    * mhist/HistLinkDef.h:
      - removed MEnergies.cc
+   
+   * mbase/MReadTree.cc:
+     - removed a bug which causes MReadTree to show strange behaviour.
+       We cannot use GetBranch()->SetAddress() we have to use
+       SetBranchAddress.
 
 
Index: trunk/MagicSoft/Mars/mbase/MReadTree.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MReadTree.cc	(revision 893)
+++ trunk/MagicSoft/Mars/mbase/MReadTree.cc	(revision 894)
@@ -48,4 +48,5 @@
 #include <TArrayC.h>
 #include <TObjArray.h>
+#include <TChainElement.h>
 
 #include "MLog.h"
@@ -87,4 +88,17 @@
 MReadTree::~MReadTree()
 {
+    //
+    // Delete all the pointers to pointers to the objects where the
+    // branche data gets stored.
+    //
+    TIter Next(fChain->GetStatus());
+
+    TChainElement *element = NULL;
+    while ((element=(TChainElement*)Next()))
+        delete (MParContainer**)element->GetBaddress();
+
+    //
+    // Delete the chain and the veto list
+    //
     delete fChain;
     delete fVetoList;
@@ -161,11 +175,18 @@
             continue;
 
+
+        //
+        // Create a pointer to the pointer to the object in which the
+        // branch data is stored. The pointers are stored in the TChain
+        // object and we get the pointers from there to delete it.
+        //
+        MParContainer **pcont = new MParContainer*;
+
         //
         // check if object is existing in the list
         //
-        MParContainer *pcont = pList->FindCreateObj(name);
-        
-
-        if (!pcont)
+        *pcont=pList->FindCreateObj(name);
+
+        if (!*pcont)
         {
             //
@@ -182,5 +203,5 @@
         //
         // FIXME: is it correct, that the pointer is deleted immediatly afterwards?
-        branch->SetAddress(&pcont);
+        fChain->SetBranchAddress(name, pcont);
     }
 
@@ -207,4 +228,5 @@
     //
     fChain->GetEntry(fNumEntry);
+    cout << " " << fChain->LoadTree(fNumEntry) << " "<<flush;
 
     fNumEntry++;
