From 71bc953009d275a48e997446bda1d14c6b570c16 Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 26 Jan 2005 09:07:48 +0000 Subject: [PATCH] In Split(), fix removal from a set being iterated, leading to exception at study restoration if there are intersecting groups --- src/DriverMED/DriverMED_Family.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/DriverMED/DriverMED_Family.cxx b/src/DriverMED/DriverMED_Family.cxx index 34ff2c20b..d9ff5b249 100644 --- a/src/DriverMED/DriverMED_Family.cxx +++ b/src/DriverMED/DriverMED_Family.cxx @@ -350,14 +350,16 @@ void DriverMED_Family::Split (DriverMED_FamilyPtr by, { // Elements set::iterator anIter = by->myElements.begin(); - for (; anIter != by->myElements.end(); anIter++) + while ( anIter != by->myElements.end()) { if (myElements.find(*anIter) != myElements.end()) { common->myElements.insert(*anIter); myElements.erase(*anIter); - by->myElements.erase(*anIter); + by->myElements.erase(anIter++); } + else + anIter++; } if (!common->IsEmpty()) -- 2.39.2