Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Search in map only once.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 5 Feb 2018 15:34:23 +0000 (16:34 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 5 Feb 2018 15:34:23 +0000 (16:34 +0100)
src/smpi/internals/smpi_global.cpp

index 0e46a52..776bdcf 100644 (file)
@@ -612,9 +612,10 @@ void SMPI_init(){
     process_data.insert({actor, new simgrid::smpi::Process(actor, nullptr)});
   });
   simgrid::s4u::Actor::onDestruction.connect([](simgrid::s4u::ActorPtr actor) {
-    if (process_data.find(actor) != process_data.end()) {
-      delete process_data.at(actor);
-      process_data.erase(actor);
+    auto it = process_data.find(actor);
+    if (it != process_data.end()) {
+      delete it->second;
+      process_data.erase(it);
     }
   });