From: ptv Date: Mon, 3 Jul 2006 07:47:19 +0000 (+0000) Subject: During remove node from STL map, please take about iterator. Problem noticed under... X-Git-Tag: LAST_STABLE_VERSION_21_09_2006_ON_3_2_0~19 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=aabfa4fe382972b0f72568c93e2467bda91e4432;p=modules%2Fsmesh.git During remove node from STL map, please take about iterator. Problem noticed under Rational Purify --- diff --git a/src/SMDS/SMDS_VolumeTool.cxx b/src/SMDS/SMDS_VolumeTool.cxx index 7ee1f81f2..66185f0bf 100644 --- a/src/SMDS/SMDS_VolumeTool.cxx +++ b/src/SMDS/SMDS_VolumeTool.cxx @@ -1266,17 +1266,22 @@ bool SMDS_VolumeTool::IsFreeFace( int faceIndex ) if ( IsFaceExternal( faceIndex )) intNormal = XYZ( -intNormal.x, -intNormal.y, -intNormal.z ); XYZ p0 ( nodes[0] ), baryCenter; - for ( vNbIt = volNbShared.begin(); vNbIt != volNbShared.end(); vNbIt++ ) { + for ( vNbIt = volNbShared.begin(); vNbIt != volNbShared.end(); ) { int nbShared = (*vNbIt).second; if ( nbShared >= 3 ) { SMDS_VolumeTool volume( (*vNbIt).first ); volume.GetBaryCenter( baryCenter.x, baryCenter.y, baryCenter.z ); XYZ intNormal2( baryCenter - p0 ); if ( intNormal.Dot( intNormal2 ) < 0 ) + { + vNbIt++; continue; // opposite side + } } // remove a volume from volNbShared map - volNbShared.erase( vNbIt ); + TElemIntMap::iterator vErIt = vNbIt; + vNbIt++; + volNbShared.erase( vErIt ); } // here volNbShared contains only volumes laying on the