After adding new particles, the first thread runs on the "old" particles, so without resizing of _forceData in ensureSize() (ForceContainer.hpp:87)
And at time, when first thread adds new force to _forceData, second thread starts to run on the "new" particles and do resize of _forceData in ensureSize(). After this first thread have segfault.
Bug fixed after adding "forces.resize(bodies->size());" to Scene.cpp, after line 76.
Seems, cause is next:
After adding new particles, the first thread runs on the "old" particles, so without resizing of _forceData in ensureSize() (ForceContainer .hpp:87)
And at time, when first thread adds new force to _forceData, second thread starts to run on the "new" particles and do resize of _forceData in ensureSize(). After this first thread have segfault.
Bug fixed after adding "forces. resize( bodies- >size() );" to Scene.cpp, after line 76.
Vaclav, could not you fix it?