Hi,

In 2geom/path.cpp, ll 338-340, the following can be found:

 

// this approach depends on std::vector's behavior WRT iterator stability

get_curves().erase(first_replaced, last_replaced);

get_curves().insert(first_replaced, first, last);

 

get_curves() returns a std::vector&, all parameters are iterators.

Both the comment and a failed debug assertion (Expression: vector insert iterator outside range) made me look this case up and I’m quite sure that this is not allowed:

 

std::vector::erase

Iterator validity

Iterators, pointers and references pointing to position (or first) and beyond are invalidated […].

http://www.cplusplus.com/reference/vector/vector/erase/

 

So (at least) first_replaced is invalid in the second line.

Can anyone confirm this? Is there an easy workaround?

 

Regards,

Markus