+ // [bos#40730] Random crash when running script from terminal:
+ // In this specific case, when iterating over all constraints and finding a MiddlePoint
+ // constraint, it gets notified, causing it to be removed and readded to the map.
+ // At that time, the iterator gets out-of-date and iterating further leads to invalid
+ // pointers, causing the crash.
+ std::map<ConstraintPtr, ConstraintWrapperPtr>::iterator aNextCIt = aCIt;
+ for (; aCIt != myConstraintMap.end(); aCIt=aNextCIt) {
+ ++aNextCIt;