Problem 944

Summary: G4 crash in G4ExcitationHandler.cc
Product: Geant4 Reporter: porosev
Component: processes/hadronic/models/de_excitationAssignee: alexander.howard
Status: RESOLVED DUPLICATE    
Severity: critical CC: alexander.howard
Priority: P5    
Version: 8.2   
Hardware: All   
OS: All   

Description porosev 2007-05-10 06:42:59 CEST
Hello all!

I have found strange place in G4ExcitationHandler.cc Ln.224 (function G4ExcitationHandler::BreakItUp(const G4Fragment &theInitialState) const)

.. 
 for (j = theResultList.begin(); j != theResultList.end(); j++) 
    {
      if ((*j)->GetA() > 1 && (*j)->GetExcitationEnergy() > 0.1*eV) 
        {
        ....
              // Remove excited fragment from the result 
              delete (*j);
              theResultList.erase(j--); <<<<BUG HAPPENS HERE!!!!!!!!
        ....
        }
     }

Description:
It happens when "theResultList" contains only ONE!!! element. The command delete(*j)
delete this element and after that when you try decrement "j--" in the command "theResultList.erase(j--)", the GEANT4 crash in "--" 

		_Myt_iter operator--(int)
			{	// postdecrement
			_Myt_iter _Tmp = *this;
			--*this;
			return (_Tmp);
                        }

because nothing to iterate!!!!!!

Sincerely Yours,
Viacheslav Porosev
Comment 1 alexander.howard 2007-05-16 18:28:02 CEST

*** This problem has been marked as a duplicate of problem 947 ***
Comment 2 alexander.howard 2007-05-16 18:35:20 CEST
Hi,
This is a duplicate bug as #947, however, could you indicate which platform and compiler you are running with?
Thanks,
Alex