std::vector<point> plans2 = plans;
would always be at the root of the problem (the backtrace also produced erroneous line numbers, for some reason, making it hard to debug). Having replaced these lines with stuff likestd::vector<point> plans2;
for (int i = 0; i < plans.size(); i++)
I hope I've solved the issue for good, and eradicated my last known segfault. This should reduce crashes to 1% of what they used to be!