Index: trunk/source/processes/hadronic/models/management/History
===================================================================
--- trunk/source/processes/hadronic/models/management/History	(revision 1201)
+++ trunk/source/processes/hadronic/models/management/History	(revision 1228)
@@ -14,4 +14,8 @@
      * Please list in reverse chronological order (last date on top)
      ---------------------------------------------------------------
+
+2 December 2009 - V.Ivanchenko (hadr-modman-V09-02-08)
+------------------------------------------------------
+-  G4HadronicInteractionRegistry - more accurate model deletion
 
 19 November 2009 Gunter Folger  (hadr-modman-V09-02-07)
Index: trunk/source/processes/hadronic/models/management/include/G4HadronicInteraction.hh
===================================================================
--- trunk/source/processes/hadronic/models/management/include/G4HadronicInteraction.hh	(revision 1201)
+++ trunk/source/processes/hadronic/models/management/include/G4HadronicInteraction.hh	(revision 1228)
@@ -26,5 +26,5 @@
 //
 // $Id: G4HadronicInteraction.hh,v 1.13 2009/10/02 17:18:33 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-03-cand-01 $
+// GEANT4 tag $Name: geant4-09-03 $
 //
 // Hadronic Interaction  abstract base class
Index: trunk/source/processes/hadronic/models/management/include/G4HadronicInteractionRegistry.hh
===================================================================
--- trunk/source/processes/hadronic/models/management/include/G4HadronicInteractionRegistry.hh	(revision 1201)
+++ trunk/source/processes/hadronic/models/management/include/G4HadronicInteractionRegistry.hh	(revision 1228)
@@ -25,5 +25,5 @@
 //
 // $Id: G4HadronicInteractionRegistry.hh,v 1.5 2009/08/30 16:12:34 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-03-cand-01 $
+// GEANT4 tag $Name: geant4-09-03 $
 //
 // 23-Jan-2009 V.Ivanchenko make the class to be a singleton
Index: trunk/source/processes/hadronic/models/management/include/G4InelasticInteraction.hh
===================================================================
--- trunk/source/processes/hadronic/models/management/include/G4InelasticInteraction.hh	(revision 1201)
+++ trunk/source/processes/hadronic/models/management/include/G4InelasticInteraction.hh	(revision 1228)
@@ -26,5 +26,5 @@
 //
 // $Id: G4InelasticInteraction.hh,v 1.7 2009/08/30 16:12:13 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-03-cand-01 $
+// GEANT4 tag $Name: geant4-09-03 $
 //
 // Hadronic Process: Inelastic Interaction 
Index: trunk/source/processes/hadronic/models/management/include/G4V3DNucleus.hh
===================================================================
--- trunk/source/processes/hadronic/models/management/include/G4V3DNucleus.hh	(revision 1201)
+++ trunk/source/processes/hadronic/models/management/include/G4V3DNucleus.hh	(revision 1228)
@@ -26,5 +26,5 @@
 //
 // $Id: G4V3DNucleus.hh,v 1.7 2009/11/19 14:29:05 gunter Exp $
-// GEANT4 tag $Name: geant4-09-03-cand-01 $
+// GEANT4 tag $Name: geant4-09-03 $
 //
 #ifndef G4V3DNucleus_h
Index: trunk/source/processes/hadronic/models/management/include/G4VHighEnergyGenerator.hh
===================================================================
--- trunk/source/processes/hadronic/models/management/include/G4VHighEnergyGenerator.hh	(revision 1201)
+++ trunk/source/processes/hadronic/models/management/include/G4VHighEnergyGenerator.hh	(revision 1228)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VHighEnergyGenerator.hh,v 1.4 2006/06/29 20:45:41 gunter Exp $
-// GEANT4 tag $Name: geant4-09-03-cand-01 $
+// GEANT4 tag $Name: geant4-09-03 $
 //
 #ifndef G4VHighEnergyGenerator_h
Index: trunk/source/processes/hadronic/models/management/include/G4VIntraNuclearTransportModel.hh
===================================================================
--- trunk/source/processes/hadronic/models/management/include/G4VIntraNuclearTransportModel.hh	(revision 1201)
+++ trunk/source/processes/hadronic/models/management/include/G4VIntraNuclearTransportModel.hh	(revision 1228)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VIntraNuclearTransportModel.hh,v 1.4 2007/01/11 05:29:46 dennis Exp $
-// GEANT4 tag $Name: geant4-09-03-cand-01 $
+// GEANT4 tag $Name: geant4-09-03 $
 //
 // $Id: G4IntraNuclearTransportMode.hh,v 1.0 1998/06/30
Index: trunk/source/processes/hadronic/models/management/include/G4VKineticNucleon.hh
===================================================================
--- trunk/source/processes/hadronic/models/management/include/G4VKineticNucleon.hh	(revision 1201)
+++ trunk/source/processes/hadronic/models/management/include/G4VKineticNucleon.hh	(revision 1228)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VKineticNucleon.hh,v 1.4 2006/06/29 20:45:47 gunter Exp $
-// GEANT4 tag $Name: geant4-09-03-cand-01 $
+// GEANT4 tag $Name: geant4-09-03 $
 //
 #ifndef G4VKineticNucleon_h
Index: trunk/source/processes/hadronic/models/management/include/G4VNuclearDensity.hh
===================================================================
--- trunk/source/processes/hadronic/models/management/include/G4VNuclearDensity.hh	(revision 1201)
+++ trunk/source/processes/hadronic/models/management/include/G4VNuclearDensity.hh	(revision 1228)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VNuclearDensity.hh,v 1.4 2006/06/29 20:45:49 gunter Exp $
-// GEANT4 tag $Name: geant4-09-03-cand-01 $
+// GEANT4 tag $Name: geant4-09-03 $
 //
 #ifndef G4VNuclearDensity_h
Index: trunk/source/processes/hadronic/models/management/include/G4VPreCompoundModel.hh
===================================================================
--- trunk/source/processes/hadronic/models/management/include/G4VPreCompoundModel.hh	(revision 1201)
+++ trunk/source/processes/hadronic/models/management/include/G4VPreCompoundModel.hh	(revision 1228)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VPreCompoundModel.hh,v 1.5 2007/01/11 05:29:34 dennis Exp $
-// GEANT4 tag $Name: geant4-09-03-cand-01 $
+// GEANT4 tag $Name: geant4-09-03 $
 //
 
Index: trunk/source/processes/hadronic/models/management/src/G4HadronicInteraction.cc
===================================================================
--- trunk/source/processes/hadronic/models/management/src/G4HadronicInteraction.cc	(revision 1201)
+++ trunk/source/processes/hadronic/models/management/src/G4HadronicInteraction.cc	(revision 1228)
@@ -25,5 +25,5 @@
 //
 // $Id: G4HadronicInteraction.cc,v 1.6 2009/08/30 16:12:34 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-03-cand-01 $
+// GEANT4 tag $Name: geant4-09-03 $
 //
 // Hadronic Interaction  base class
Index: trunk/source/processes/hadronic/models/management/src/G4HadronicInteractionRegistry.cc
===================================================================
--- trunk/source/processes/hadronic/models/management/src/G4HadronicInteractionRegistry.cc	(revision 1201)
+++ trunk/source/processes/hadronic/models/management/src/G4HadronicInteractionRegistry.cc	(revision 1228)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4HadronicInteractionRegistry.cc,v 1.8 2009/08/30 16:12:34 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-03-cand-01 $
+// $Id: G4HadronicInteractionRegistry.cc,v 1.9 2009/12/02 15:57:57 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03 $
 //
 // 23-Jan-2009 V.Ivanchenko make the class to be a singleton
@@ -53,6 +53,6 @@
 void G4HadronicInteractionRegistry::Clean()
 {
+  size_t nModels = allModels.size();
   //G4cout << "G4HadronicInteractionRegistry::Clean() start " << nModels << G4endl;
-  size_t nModels = allModels.size();
   if(0 < nModels) {
     for (size_t i=0; i<nModels; ++i) {
@@ -60,10 +60,11 @@
 	//G4cout << "delete " << i << G4endl;
         //G4cout << allModels[i]->GetModelName() << G4endl;
-	delete allModels[i];
+	G4HadronicInteraction * model = allModels[i];
 	allModels[i] = 0;
+	delete model;
       }
     }
+    allModels.clear();
   }
-  allModels.clear();
   //G4cout << "G4HadronicInteractionRegistry::Clean() is done " << G4endl; 
 }
@@ -72,8 +73,9 @@
 RegisterMe(G4HadronicInteraction * aModel)
 {
+  if(!aModel) { return; }
   size_t nModels = allModels.size();
   if(nModels > 0) {
     for (size_t i=0; i<nModels; ++i) {
-      if( aModel == allModels[i] ) return;
+      if( aModel == allModels[i] ) { return; }
     }
   }
@@ -86,6 +88,7 @@
 RemoveMe(G4HadronicInteraction * aModel)
 {
+  if(!aModel) { return; }
   size_t nModels = allModels.size();
-  if(0 == nModels) return;
+  if(0 == nModels) { return; }
   for (size_t i=0; i<nModels; ++i) {
     if( aModel == allModels[i] ) {
Index: trunk/source/processes/hadronic/models/management/src/G4InelasticInteraction.cc
===================================================================
--- trunk/source/processes/hadronic/models/management/src/G4InelasticInteraction.cc	(revision 1201)
+++ trunk/source/processes/hadronic/models/management/src/G4InelasticInteraction.cc	(revision 1228)
@@ -25,5 +25,5 @@
 //
 // $Id: G4InelasticInteraction.cc,v 1.12 2009/01/24 11:56:27 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-03-cand-01 $
+// GEANT4 tag $Name: geant4-09-03 $
 //
 // Hadronic Process: Inelastic Interaction 
Index: trunk/source/processes/hadronic/models/management/src/G4V3DNucleus.cc
===================================================================
--- trunk/source/processes/hadronic/models/management/src/G4V3DNucleus.cc	(revision 1201)
+++ trunk/source/processes/hadronic/models/management/src/G4V3DNucleus.cc	(revision 1228)
@@ -26,5 +26,5 @@
 //
 // $Id: G4V3DNucleus.cc,v 1.5 2006/06/29 20:45:59 gunter Exp $
-// GEANT4 tag $Name: geant4-09-03-cand-01 $
+// GEANT4 tag $Name: geant4-09-03 $
 //
 #include "G4V3DNucleus.hh"
Index: trunk/source/processes/hadronic/models/management/src/G4VHighEnergyGenerator.cc
===================================================================
--- trunk/source/processes/hadronic/models/management/src/G4VHighEnergyGenerator.cc	(revision 1201)
+++ trunk/source/processes/hadronic/models/management/src/G4VHighEnergyGenerator.cc	(revision 1228)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VHighEnergyGenerator.cc,v 1.5 2006/06/29 20:46:03 gunter Exp $
-// GEANT4 tag $Name: geant4-09-03-cand-01 $
+// GEANT4 tag $Name: geant4-09-03 $
 //
 // G4VHighEnergyGenerator
Index: trunk/source/processes/hadronic/models/management/src/G4VIntraNuclearTransportModel.cc
===================================================================
--- trunk/source/processes/hadronic/models/management/src/G4VIntraNuclearTransportModel.cc	(revision 1201)
+++ trunk/source/processes/hadronic/models/management/src/G4VIntraNuclearTransportModel.cc	(revision 1228)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VIntraNuclearTransportModel.cc,v 1.5 2007/01/11 05:28:56 dennis Exp $
-// GEANT4 tag $Name: geant4-09-03-cand-01 $
+// GEANT4 tag $Name: geant4-09-03 $
 //
 // $Id: G4VIntraNuclearTransportModel.cc,v 1.0 1998/06/30
Index: trunk/source/processes/hadronic/models/management/src/G4VKineticNucleon.cc
===================================================================
--- trunk/source/processes/hadronic/models/management/src/G4VKineticNucleon.cc	(revision 1201)
+++ trunk/source/processes/hadronic/models/management/src/G4VKineticNucleon.cc	(revision 1228)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VKineticNucleon.cc,v 1.3 2006/06/29 20:46:07 gunter Exp $
-// GEANT4 tag $Name: geant4-09-03-cand-01 $
+// GEANT4 tag $Name: geant4-09-03 $
 //
 #include "G4VKineticNucleon.hh"
Index: trunk/source/processes/hadronic/models/management/src/G4VNuclearDensity.cc
===================================================================
--- trunk/source/processes/hadronic/models/management/src/G4VNuclearDensity.cc	(revision 1201)
+++ trunk/source/processes/hadronic/models/management/src/G4VNuclearDensity.cc	(revision 1228)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VNuclearDensity.cc,v 1.3 2006/06/29 20:46:09 gunter Exp $
-// GEANT4 tag $Name: geant4-09-03-cand-01 $
+// GEANT4 tag $Name: geant4-09-03 $
 //
 
Index: trunk/source/processes/hadronic/models/management/src/G4VPreCompoundModel.cc
===================================================================
--- trunk/source/processes/hadronic/models/management/src/G4VPreCompoundModel.cc	(revision 1201)
+++ trunk/source/processes/hadronic/models/management/src/G4VPreCompoundModel.cc	(revision 1228)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VPreCompoundModel.cc,v 1.6 2007/01/11 05:29:10 dennis Exp $
-// GEANT4 tag $Name: geant4-09-03-cand-01 $
+// GEANT4 tag $Name: geant4-09-03 $
 //
 
