Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 5069)
+++ trunk/MagicSoft/Mars/Changelog	(revision 5070)
@@ -19,4 +19,11 @@
 
                                                  -*-*- END OF LINE -*-*-
+
+ 2004/09/16: Markus Gaug
+
+   * mhcalib/MHCalibrationChargeBlindPix.cc
+   * mhcalib/MHGausEvents.cc
+     - added call to gROOT->GetListOfFunctions->Remove(f) in destructor
+
 
  2004/09/16: Thomas Bretz
Index: trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeBlindPix.cc
===================================================================
--- trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeBlindPix.cc	(revision 5069)
+++ trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeBlindPix.cc	(revision 5070)
@@ -147,6 +147,9 @@
 
   if (fSinglePheFit)
-    delete fSinglePheFit;
-
+    {
+      gROOT->GetListOfFunctions()->Remove(fSinglePheFit);
+      delete fSinglePheFit;
+    }
+  
   if (fFitLegend)
     delete fFitLegend;
Index: trunk/MagicSoft/Mars/mhcalib/MHGausEvents.cc
===================================================================
--- trunk/MagicSoft/Mars/mhcalib/MHGausEvents.cc	(revision 5069)
+++ trunk/MagicSoft/Mars/mhcalib/MHGausEvents.cc	(revision 5070)
@@ -163,10 +163,17 @@
 // 
 // - fHPowerProbability
-// - fFGausFit 
-// - fFExpFit
 // - fPowerSpectrum     
 // - fGraphEvents
 // - fGraphPowerSpectrum
 // 
+// For the fits, we have to take special care since ROOT 
+// has stored the function pointer in a global list which 
+// lead to removing the object twice. We have to take out 
+// the following functions of the global list of functions 
+// as well:
+// 
+// - fFGausFit 
+// - fFExpFit
+//
 MHGausEvents::~MHGausEvents()
 {
@@ -178,8 +185,14 @@
   // delete fits
   if (fFGausFit)
-    delete fFGausFit; 
-
+    {
+      gROOT->GetListOfFunctions()->Remove(fFGausFit);
+      delete fFGausFit; 
+    }
+  
   if (fFExpFit)
-    delete fFExpFit;
+    {
+      gROOT->GetListOfFunctions()->Remove(fFExpFit);
+      delete fFExpFit;
+    }
   
   // delete arrays
