Problem 692

Summary: The destructor of G4HadronicInteractionRegistry might become impossible to finish.
Product: Geant4 Reporter: tkoi
Component: processes/hadronic/modelsAssignee: Hans-Peter.Wellisch
Status: RESOLVED INVALID    
Severity: normal    
Priority: P2    
Version: 6.2   
Hardware: Other   
OS: Other   

Description tkoi 2004-11-19 17:53:42 CET
If a size of allModels is not 0, the while loop in the destructor becomes an
infinite loop.

 46 G4HadronicInteractionRegistry::~G4HadronicInteractionRegistry()
 47 {
 48   while(allModels.size()!=0)
 49   {
 50     delete allModels.front();
 51   }
 52 }
Is this correct?
or
 48   while(allModels.size()!=0)
 49   {
 50     allModels.erase( allModels.begin() );
 51   }
is a correct implementation what you want to do?

Tatsumi
Comment 1 Hans-Peter.Wellisch 2005-02-22 04:24:59 CET
Hi Tatsumi,

  I am stunned. The code you show me should result on a loop in every single
job. I'll have to find out, why this is not the case...

Regards,

Hans-Peter.
Comment 2 Hans-Peter.Wellisch 2005-02-22 04:27:59 CET
Hi Tatsumi,

  I checked, and found that it is ok. The code as it is gives the desired
behavior.

Many greetings,

Hans-Peter.