Segfault with X and OMP
If I run aevol with X and OMP on, I get a segfault after running for a few (hundreds) generations.
Here is an LLDB trace:
frame #0: 0x00000001000a89d8 aevol_run`aevol::ReplicationReport::init(this=0x0000000000000000, tree=0x0000000100b35370, offspring=0x00000001022dd400, parent=0x00000001022dd400, indiv_id=125, parent_id=105) at ReplicationReport.cpp:183:10
180 void ReplicationReport::init(Tree* tree, Individual* offspring, Individual* parent, int indiv_id, int parent_id)
181 {
182
-> 183 indiv_ = offspring;
184
185 id_ = indiv_id;
186 parent_id_ = parent_id;
Target 0: (aevol_run) stopped.
(lldb) bt
* thread #2, stop reason = EXC_BAD_ACCESS (code=1, address=0x10)
* frame #0: 0x00000001000a89d8 aevol_run`aevol::ReplicationReport::init(this=0x0000000000000000, tree=0x0000000100b35370, offspring=0x00000001022dd400, parent=0x00000001022dd400, indiv_id=125, parent_id=105) at ReplicationReport.cpp:183:10
frame #1: 0x000000010007808e aevol_run`aevol::Tree::update(this=0x0000000100b35370, o=0x0000000100a01b00, e=NEW_INDIV, arg=0x00000001008cbf00) at Tree.cpp:251:17
frame #2: 0x00000001000fe093 aevol_run`Observable::notifyObservers(this=0x0000000100a01b00, e=NEW_INDIV, arg=0x00000001008cbf00) at Observable.cpp:55:12
frame #3: 0x00000001000aea62 aevol_run`aevol::Selection::do_replication(this=0x0000000100a01b00, parent=0x00000001022dd400, index=125, type_mutate=0x000070000dda9a7f, x=6, y=5) at Selection.cpp:891:7
frame #4: 0x00000001000ada2d aevol_run`::.omp_outlined._debug__.2(.global_tid.=0x000070000dda9c10, .bound_tid.=0x000070000dda9c08, grid_height=0x00007ffeefbff64c, grid_width=0x00007ffeefbff64e, this=0x0000000100a01b00, reproducers=0x00007ffeefbff638, to_evaluate=size=14, pop_grid=0x00007ffeefbff640) at Selection.cpp:317:5
frame #5: 0x00000001000af07f aevol_run`::.omp_outlined..3(.global_tid.=0x000070000dda9c10, .bound_tid.=0x000070000dda9c08, grid_height=0x00007ffeefbff64c, grid_width=0x00007ffeefbff64e, this=0x0000000100a01b00, reproducers=0x00007ffeefbff638, to_evaluate=size=14, pop_grid=0x00007ffeefbff640) at Selection.cpp:301:3
frame #6: 0x000000010059cfc3 libomp.dylib`__kmp_invoke_microtask + 147
frame #7: 0x000000010056b1d9 libomp.dylib`__kmp_invoke_task_func + 334
frame #8: 0x000000010056a6f3 libomp.dylib`__kmp_launch_thread + 374
frame #9: 0x00000001005900f2 libomp.dylib`__kmp_launch_worker(void*) + 280
frame #10: 0x00007fff66643e65 libsystem_pthread.dylib`_pthread_start + 148
frame #11: 0x00007fff6663f83b libsystem_pthread.dylib`thread_start + 15
Given this, I assume there's a race condition and ReplicationReport tries to access an already-freed individual.