The singleton instance of G4StateManager is created in G4StateManager::GetStateManager(). When G4RunManager is stopping, this instance is deleted by G4RunManagerKernel::~G4RunManagerKernel(). But then static variable G4StateManager::theStateManager is not cleared. The error occurs when the same executable attempts to create 2 or more instances of G4RunManager, see an example here: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/runmanage/440.html
Suggested fix: File: G4StateManager.cc Method: G4StateManager::~G4StateManager() G4StateManager::~G4StateManager() { G4VStateDependent* state=0; while (theDependentsList.size()>0) { state = theDependentsList.back(); theDependentsList.pop_back(); for (std::vector<G4VStateDependent*>::iterator i=theDependentsList.begin(); i!=theDependentsList.end();) { if (*i==state) { i = theDependentsList.erase(i); } else { ++i; } } if ( state ) { delete state; } } theStateManager = 0; // <-- this is the patch #ifdef G4MULTITHREADED_DEACTIVATE G4iosFinalization(); #endif }
Thanks. This is now fixed in the development version and will be available in the next release.