[Avida-SVN] r2970 - development/source/main

mmcgill at myxo.css.msu.edu mmcgill at myxo.css.msu.edu
Tue Nov 25 08:54:56 PST 2008


Author: mmcgill
Date: 2008-11-25 11:54:56 -0500 (Tue, 25 Nov 2008)
New Revision: 2970

Modified:
   development/source/main/cPopulation.cc
Log:
removed dereference of pointer that may no longer be valid, which was causing memory access violations

Modified: development/source/main/cPopulation.cc
===================================================================
--- development/source/main/cPopulation.cc	2008-11-24 19:46:35 UTC (rev 2969)
+++ development/source/main/cPopulation.cc	2008-11-25 16:54:56 UTC (rev 2970)
@@ -3472,6 +3472,7 @@
   
   cell.GetHardware()->SingleProcess(ctx);    
   
+  double merit = cur_org->GetPhenotype().GetMerit().GetDouble();
   if (cur_org->GetPhenotype().GetToDelete() == true) delete cur_org;
   
   m_world->GetStats().IncExecuted();
@@ -3483,7 +3484,7 @@
     for(int i = 0; i < GetNumDemes(); i++) GetDeme(i).Update(step_size);
     
     cDeme & deme = GetDeme(GetCell(cell_id).GetDemeID());
-    deme.IncTimeUsed(cur_org->GetPhenotype().GetMerit().GetDouble());
+    deme.IncTimeUsed(merit);
     CheckImplicitDemeRepro(deme);
   }
 }




More information about the Avida-cvs mailing list