Fix a segfault in BRepMesh_FastDiscret

When the mesher state is BRepMesh_SelfIntersectingWire,
entries are removed from a map while iterating over it.
This happens only with some buggy faces.
Bugreport and original patch by Jerome Robert.
Closes: #589639

diff --git a/ros/src/BRepMesh/BRepMesh_FastDiscret.cxx b/ros/src/BRepMesh/BRepMesh_FastDiscret.cxx
index 9ec6e90..9dc10bc 100644
--- a/ros/src/BRepMesh/BRepMesh_FastDiscret.cxx
+++ b/ros/src/BRepMesh/BRepMesh_FastDiscret.cxx
@@ -443,8 +443,11 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Face& theface)
         
         //clear the structure of links
         const MeshDS_MapOfInteger& aLinks = structure->LinkOfDomain(nbDomains);
+        TColStd_SequenceOfInteger toRemove;
         for(MeshDS_MapOfInteger::Iterator anIter(aLinks);anIter.More();anIter.Next())
-          structure->ForseRemoveLink(anIter.Key());
+          toRemove.Append(anIter.Key());
+        for (i = 1; i <= toRemove.Length(); i++)
+          structure->ForseRemoveLink(toRemove.Value(i));
         for (i = 1; i <= myvemap.Extent(); i++)
            structure->ForseRemoveNode(myvemap.FindKey(i));
         
