Problem 1684 - G4NuclearLevelStore segfaults at exit with user defined files
Summary: G4NuclearLevelStore segfaults at exit with user defined files
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: processes/hadronic/models/de_excitation/photon_evaporation (show other problems)
Version: other
Hardware: All All
: P5 normal
Assignee: Vladimir.Ivantchenko
URL:
Depends on:
Blocks:
 
Reported: 2014-10-31 10:39 CET by Luis Sarmiento Pico
Modified: 2014-11-16 13:20 CET (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Luis Sarmiento Pico 2014-10-31 10:39:04 CET
When a user defined photon evaporation file is present in the destructor there is an attempt to delete G4String as part of the map used to store the filenames.

Unlike the other maps, the "second" component of theUserDataFiles is not a pointer.

Here is a proposed patch to fix this issue:

diff --git a/source/processes/hadronic/models/de_excitation/photon_evaporation/src/G4NuclearLevelStore.cc b/source/processes/hadronic/models/de_excitation/photon_evaporation/src/G4NuclearLevelStore.cc
index 21122ca..1bf2461 100644
--- a/source/processes/hadronic/models/de_excitation/photon_evaporation/src/G4NuclearLevelStore.cc
+++ b/source/processes/hadronic/models/de_excitation/photon_evaporation/src/G4NuclearLevelStore.cc
@@ -71,11 +71,13 @@ G4NuclearLevelStore::~G4NuclearLevelStore()
   MapForHEP::iterator j;
   for (j = managersForHEP.begin(); j != managersForHEP.end(); ++j)
     { delete j->second; }
-  if(userFiles) {
-    std::map<G4int, G4String>::iterator k;
-    for (k = theUserDataFiles.begin(); k != theUserDataFiles.end(); ++k)
-      { delete k->second; }
-  }
+
+  // G4String cannot be deleted since it is not pointer.  we can clear
+  // the map ourselves to be consistent but this should happen
+  // automatically.
+
+  // No need to check for Boolean userFiles
+  theUserDataFiles.clear();
 }
Comment 1 Vladimir.Ivantchenko 2014-11-12 11:49:47 CET
Hello,
Thank you for the clear report on the problem. The bug is fixed and the fix will be available with the next public release 10.1, December 2014.

VI
Comment 2 Vladimir.Ivantchenko 2014-11-16 13:20:12 CET
Hello,

Thank you for the clear report. The bug is fixed and the fix will be available with the new Geant4 version December, 2014.

VI