]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
MPV: fix for nug IPAL13251
authormpv <mpv@opencascade.com>
Tue, 3 Oct 2006 08:52:10 +0000 (08:52 +0000)
committermpv <mpv@opencascade.com>
Tue, 3 Oct 2006 08:52:10 +0000 (08:52 +0000)
"Mandriva64 porting: SIGSEGV during partition"

myDS->Shape and myDS->GetShape methods is very dangerous to use in the equations like the next:

const TopoDS_Face& aFace = TopoDS::Faces(myDS->Shape(anIndex));

because this reference can be invalid after the next command execution:

myDS->InsertShapeAndAncestorsSuccessors(...)

This command some times deletes old shapes from internal array to make bigger array.

src/NMTTools/NMTTools_DEProcessor.cxx
src/NMTTools/NMTTools_PaveFiller_1.cxx
src/NMTTools/NMTTools_PaveFiller_4.cxx
src/NMTTools/NMTTools_PaveFiller_5.cxx
src/NMTTools/NMTTools_PaveFiller_6.cxx
src/NMTTools/NMTTools_PaveFiller_7.cxx

index 6762a1dd3b7a417f84a6da8bc367ba0db2528b1d..b394de32857e3bf8800477f8be56d36ff22b850e 100644 (file)
   aNb=myDS->NumberOfShapesOfTheObject();
   //
   for (i=1; i<=aNb; i++) {
-    const TopoDS_Shape& aF=myDS->Shape(i);
+    const TopoDS_Shape aF=myDS->Shape(i);
     if (aF.ShapeType()==TopAbs_FACE) {
       TopExp::MapShapesAndAncestors (aF, TopAbs_EDGE, TopAbs_FACE, aMEF);
     }
   }
   //
   for (i=1; i<=aNb; i++) {
-    const TopoDS_Shape& aS=myDS->Shape(i);
+    const TopoDS_Shape aS=myDS->Shape(i);
     if (aS.ShapeType()==TopAbs_EDGE) {
       const TopoDS_Edge& aE=TopoDS::Edge(aS);
       
   // Clear aPaveSet, aSplitEdges
   aPaveSet.ChangeSet().Clear();
   //
-  const TopoDS_Edge& aDE=TopoDS::Edge(myDS->Shape(nED));
-  const TopoDS_Face& aDF=TopoDS::Face(myDS->Shape(nFD));
+  const TopoDS_Edge aDE=TopoDS::Edge(myDS->Shape(nED));
+  const TopoDS_Face aDF=TopoDS::Face(myDS->Shape(nFD));
   //
   // 2D Curve of degenerated edge on the face aDF
   Handle(Geom2d_Curve) aC2DDE=BRep_Tool::CurveOnSurface(aDE, aDF, aTD1, aTD2);
   for (; anIt.More(); anIt.Next()) {
     const BOPTools_PaveBlock& aPB=anIt.Value();
     nE=aPB.Edge();
-    const TopoDS_Edge& aE=TopoDS::Edge(myDS->Shape(nE));
+    const TopoDS_Edge aE=TopoDS::Edge(myDS->Shape(nE));
     
     Handle(Geom2d_Curve) aC2D=BRep_Tool::CurveOnSurface(aE, aDF, aT1, aT2);
     //
   TopoDS_Edge aE, aESplit;
   TopoDS_Vertex aV1, aV2;
 
-  const TopoDS_Edge& aDE=TopoDS::Edge(myDS->Shape(nED));
-  const TopoDS_Face& aDF=TopoDS::Face(myDS->Shape(nFD));
+  const TopoDS_Edge aDE=TopoDS::Edge(myDS->Shape(nED));
+  const TopoDS_Face aDF=TopoDS::Face(myDS->Shape(nFD));
 
   BOPTools_ListIteratorOfListOfPaveBlock aPBIt(aSplitEdges);
 
index 57c923e775c3578e7dddb096da0e8ac56955a7d1..448804477dda9ef07045760c501ce028e924dc18 100644 (file)
@@ -78,8 +78,8 @@
       aWith=n2;
       SortTypes(aWhat, aWith);
       if (!bJustAddInterference) {
-       const TopoDS_Shape& aS1=myDS->GetShape(aWhat);
-       const TopoDS_Shape& aS2=myDS->GetShape(aWith);
+       const TopoDS_Shape aS1=myDS->GetShape(aWhat);
+       const TopoDS_Shape aS2=myDS->GetShape(aWith);
        //
        const TopoDS_Vertex& aV1=TopoDS::Vertex(aS1);
        const TopoDS_Vertex& aV2=TopoDS::Vertex(aS2);
     aNbV=aChain.Extent();
     for (j=1; j<=aNbV; ++j) {
       aIdV=aChain(j);
-      const TopoDS_Shape& aV=myDS->Shape(aIdV);
+      const TopoDS_Shape aV=myDS->Shape(aIdV);
       if (!aM.Contains(aV)) {
        aM.Add(aV);
        aLV.Append(aV);
index 33f178c92a537cea8700b8590e28ec68962d2b35..fb8123077439a7805bd4bdd0e58661efb9121bb1 100644 (file)
@@ -145,8 +145,8 @@ static
       continue;
     }
     //
-    const TopoDS_Edge& aE1=TopoDS::Edge(myDS->Shape(nE1));
-    const TopoDS_Edge& aE2=TopoDS::Edge(myDS->Shape(nE2));
+    const TopoDS_Edge aE1=TopoDS::Edge(myDS->Shape(nE1));
+    const TopoDS_Edge aE2=TopoDS::Edge(myDS->Shape(nE2));
     //
     if (BRep_Tool::Degenerated(aE1) || BRep_Tool::Degenerated(aE2)){
       continue;
@@ -468,7 +468,7 @@ static
     aNbEdges=aME.Extent();
     for (j=1; j<=aNbEdges; ++j) {
       nE=aME(j);
-      const TopoDS_Edge& aE=TopoDS::Edge(myDS->Shape(nE));
+      const TopoDS_Edge aE=TopoDS::Edge(myDS->Shape(nE));
       //
       aFlag=myContext.ComputeVE (aNewVertex, aE, aT);
       //
@@ -775,10 +775,10 @@ static
   Standard_Real d1121, d1122, d1222, d1221, aTolSum, aCoeff=1.05;
   gp_Pnt aP11, aP12, aP21, aP22;
 
-  const TopoDS_Vertex& aV11=TopoDS::Vertex(myDS->Shape(aPB1.Pave1().Index()));
-  const TopoDS_Vertex& aV12=TopoDS::Vertex(myDS->Shape(aPB1.Pave2().Index()));
-  const TopoDS_Vertex& aV21=TopoDS::Vertex(myDS->Shape(aPB2.Pave1().Index()));
-  const TopoDS_Vertex& aV22=TopoDS::Vertex(myDS->Shape(aPB2.Pave2().Index()));
+  const TopoDS_Vertex aV11=TopoDS::Vertex(myDS->Shape(aPB1.Pave1().Index()));
+  const TopoDS_Vertex aV12=TopoDS::Vertex(myDS->Shape(aPB1.Pave2().Index()));
+  const TopoDS_Vertex aV21=TopoDS::Vertex(myDS->Shape(aPB2.Pave1().Index()));
+  const TopoDS_Vertex aV22=TopoDS::Vertex(myDS->Shape(aPB2.Pave2().Index()));
 
   aTolV11=BRep_Tool::Tolerance(aV11);
   aTolV12=BRep_Tool::Tolerance(aV12);
index db8930c0001247221ce197795693225e41a19033..a29f760ab44a3b676003817c2eefed4daa5bdd4e 100644 (file)
@@ -138,13 +138,13 @@ static
       continue;
     }
     // Edge
-    const TopoDS_Edge& aE=TopoDS::Edge(myDS->GetShape(nE));
+    const TopoDS_Edge aE=TopoDS::Edge(myDS->GetShape(nE));
     if (BRep_Tool::Degenerated(aE)){
       continue;
     }
     aTolE=BRep_Tool::Tolerance(aE);
     // Face
-    const TopoDS_Face& aF=TopoDS::Face(myDS->GetShape(nF));
+    const TopoDS_Face aF=TopoDS::Face(myDS->GetShape(nF));
     aTolF=BRep_Tool::Tolerance(aF);
     const Bnd_Box& aBBF=myDS->GetBoundingBox(nF); 
     //
@@ -492,7 +492,7 @@ static
     aNbEdges=aME.Extent();
     for (j=1; j<=aNbEdges; ++j) {
       nE=aME(j);
-      const TopoDS_Edge& aE=TopoDS::Edge(myDS->Shape(nE));
+      const TopoDS_Edge aE=TopoDS::Edge(myDS->Shape(nE));
       //
       aFlag=myContext.ComputeVE (aNewVertex, aE, aT);
       //
@@ -575,7 +575,7 @@ static
   aNbV=aMVF.Extent();
   for (i=1; i<=aNbV; ++i) {
     nVF=aMVF(i);
-    const TopoDS_Vertex& aVF=TopoDS::Vertex(myDS->Shape(nVF));
+    const TopoDS_Vertex aVF=TopoDS::Vertex(myDS->Shape(nVF));
     iFlag=IntTools_Tools::ComputeVV(aNewVertex, aVF);
     if (!iFlag) {
       return nVF;
index 8c4852a4b076d57f130d07bf9aecc0b2b5554371..3ad988b627ddd42eb0614e5ee85aa4da8b50e0c2 100644 (file)
@@ -165,8 +165,8 @@ static
       continue;
     }
     //
-    const TopoDS_Face& aF1=TopoDS::Face(myDS->Shape(nF1));
-    const TopoDS_Face& aF2=TopoDS::Face(myDS->Shape(nF2));
+    const TopoDS_Face aF1=TopoDS::Face(myDS->Shape(nF1));
+    const TopoDS_Face aF2=TopoDS::Face(myDS->Shape(nF2));
     //
     // FF
     bToApproxC3d     = mySectionAttribute.Approximation();
@@ -254,8 +254,8 @@ static
     // 
     // Faces
     aFFi.Indices(nF1, nF2);
-    const TopoDS_Face& aF1=TopoDS::Face(myDS->Shape(nF1));
-    const TopoDS_Face& aF2=TopoDS::Face(myDS->Shape(nF2));
+    const TopoDS_Face aF1=TopoDS::Face(myDS->Shape(nF1));
+    const TopoDS_Face aF2=TopoDS::Face(myDS->Shape(nF2));
     //
     BOPTools_ListOfPaveBlock aLPB, aLPBC;
     //
@@ -377,8 +377,8 @@ static
        // Make Section Edge  
        TopoDS_Edge aES;
        //
-       const TopoDS_Vertex& aV1=TopoDS::Vertex(myDS->Shape(nV1));
-       const TopoDS_Vertex& aV2=TopoDS::Vertex(myDS->Shape(nV2));
+       const TopoDS_Vertex aV1=TopoDS::Vertex(myDS->Shape(nV1));
+       const TopoDS_Vertex aV2=TopoDS::Vertex(myDS->Shape(nV2));
        //
        BOPTools_Tools::MakeSectEdge (aIC, aV1, aT1, aV2, aT2, aES);
        //
@@ -489,13 +489,13 @@ static
     for (j=1; j<=aNbSE; ++j) {
       const BOPTools_PaveBlock& aPBSE=aMEPB(j);
       nV1=aPBSE.Pave1().Index();
-      const TopoDS_Shape& aV1=myDS->Shape(nV1);
+      const TopoDS_Shape aV1=myDS->Shape(nV1);
       if (aV1.IsSame(aV)) {
        aMNewOld.Add(i, nV1);
        break;
       }
       nV2=aPBSE.Pave2().Index();
-      const TopoDS_Shape& aV2=myDS->Shape(nV2);
+      const TopoDS_Shape aV2=myDS->Shape(nV2);
       if (aV2.IsSame(aV)) {
        aMNewOld.Add(i, nV2);
        break;
@@ -546,9 +546,9 @@ static
       BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
       //
       nV1=aPBSE.Pave1().Index();
-      const TopoDS_Shape& aV1=myDS->Shape(nV1);
+      const TopoDS_Shape aV1=myDS->Shape(nV1);
       nV2=aPBSE.Pave2().Index();
-      const TopoDS_Shape& aV2=myDS->Shape(nV2);
+      const TopoDS_Shape aV2=myDS->Shape(nV2);
       //
       anASSeq.SetNewSuccessor(nV1);
       anASSeq.SetNewOrientation(aV1.Orientation());
@@ -580,8 +580,8 @@ static
       BOPTools_PaveBlock aPB=aIt.Value();
       //
       ////modified by NIZNHY-PKV Thu Jan 26 10:16:36 2006f
-      const TopoDS_Face& aF1=TopoDS::Face(myDS->Shape(nF1));
-      const TopoDS_Face& aF2=TopoDS::Face(myDS->Shape(nF2));
+      const TopoDS_Face aF1=TopoDS::Face(myDS->Shape(nF1));
+      const TopoDS_Face aF2=TopoDS::Face(myDS->Shape(nF2));
       ////modified by NIZNHY-PKV Thu Jan 26 10:16:39 2006t
       //
       if (aCBAPI.IsCommonBlock(aPB)) {
@@ -617,13 +617,13 @@ static
       aT1=aPave1.Param();
       mV1=aPave1.Index();            // index in tDS
       nV1=aMNewOld.FindFromKey(mV1); // index in myDS
-      const TopoDS_Shape& aV1=myDS->Shape(nV1);
+      const TopoDS_Shape aV1=myDS->Shape(nV1);
       //
       const BOPTools_Pave& aPave2=aPB.Pave2();
       aT2=aPave2.Param();
       mV2=aPave2.Index();
       nV2=aMNewOld.FindFromKey(mV2);
-      const TopoDS_Shape& aV2=myDS->Shape(nV2);
+      const TopoDS_Shape aV2=myDS->Shape(nV2);
       //
       if (!aMNewOld.Contains(mE)) {
        // add new SE to the myDS
@@ -684,8 +684,8 @@ static
     BOPTools_SSInterference& aFF=aFFs(i);
     aFF.Indices(nF1, nF2);
     //
-    const TopoDS_Face& aF1=TopoDS::Face(myDS->Shape(nF1));
-    const TopoDS_Face& aF2=TopoDS::Face(myDS->Shape(nF2));
+    const TopoDS_Face aF1=TopoDS::Face(myDS->Shape(nF1));
+    const TopoDS_Face aF2=TopoDS::Face(myDS->Shape(nF2));
     //
     aF1FWD=aF1;
     aF1FWD.Orientation(TopAbs_FORWARD);
@@ -699,7 +699,7 @@ static
     for (; anIt.More(); anIt.Next()) {
       const BOPTools_PaveBlock& aPB=anIt.Value();
       nE=aPB.Edge();
-      const TopoDS_Edge& aE=TopoDS::Edge(myDS->Shape(nE));
+      const TopoDS_Edge aE=TopoDS::Edge(myDS->Shape(nE));
       
       BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF1FWD);
       BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF2FWD);
@@ -768,7 +768,7 @@ static
   //
   //Edge
   nE2=aPBR.Edge();
-  const TopoDS_Edge& aE2=TopoDS::Edge(myDS->GetShape(nE2));
+  const TopoDS_Edge aE2=TopoDS::Edge(myDS->GetShape(nE2));
   // VE
   iVM=myContext.ComputeVE(aVM, aE2, aTmp); 
   //
@@ -799,8 +799,8 @@ static
   aFFi.Indices(nF1, nF2);
   aTolR3D=aFFi.TolR3D();
   //
-  const TopoDS_Face& aF1=TopoDS::Face(myDS->GetShape(nF1));
-  const TopoDS_Face& aF2=TopoDS::Face(myDS->GetShape(nF2));
+  const TopoDS_Face aF1=TopoDS::Face(myDS->GetShape(nF1));
+  const TopoDS_Face aF2=TopoDS::Face(myDS->GetShape(nF2));
   //
   bVF=myContext.IsValidPointForFaces (aP1, aF1, aF2, aTolR3D);
   if (bVF) {
@@ -850,14 +850,13 @@ static
     TColStd_ListOfInteger& aTVs=aBC.TechnoVertices();
     aTVs.Append(nV);
   }
-  
   if (bFound1 && !bFound2) {
     nV=aPave1.Index();
     aPave.SetIndex(nV);
     aPave.SetParam(aT);
     aFFiPS.Append(aPave);
     //
-    const TopoDS_Vertex& aV=TopoDS::Vertex(myDS->Shape(nV));
+    const TopoDS_Vertex aV=TopoDS::Vertex(myDS->Shape(nV));
     BOPTools_Tools::UpdateVertex (aIC, aT, aV);
   }
   
@@ -867,7 +866,7 @@ static
     aPave.SetParam(aT);
     aCPS.Append(aPave);
     //
-    const TopoDS_Vertex& aV=TopoDS::Vertex(myDS->Shape(nV));
+    const TopoDS_Vertex aV=TopoDS::Vertex(myDS->Shape(nV));
     BOPTools_Tools::UpdateVertex (aIC, aT, aV);
   }
 }
@@ -888,7 +887,7 @@ static
   for (; anIt.More(); anIt.Next()) {
     const BOPTools_Pave& aPC=anIt.Value();
     nV=aPC.Index();
-    const TopoDS_Vertex& aV=TopoDS::Vertex(myDS->Shape(nV));
+    const TopoDS_Vertex aV=TopoDS::Vertex(myDS->Shape(nV));
     bIsVertex=IntTools_Tools::IsVertex (aP, aTolPV, aV);
     if (bIsVertex) {
       aPave=aPC;
@@ -974,7 +973,7 @@ static
     const BOPTools_Pave& aPave=anIt.Value();
     //
     nV=aPave.Index();
-    const TopoDS_Vertex& aV=TopoDS::Vertex(myDS->Shape(nV));
+    const TopoDS_Vertex aV=TopoDS::Vertex(myDS->Shape(nV));
     //
     Bnd_Box aBBV;
     BRepBndLib::Add(aV, aBBV);
index 50d899ad9c8c903e6e579b65182ce14711aa1728..3c9d4f7ac30a8f999ea3f06c4881ce2a4b33b072 100644 (file)
   for(i=1; i<=aNbF; ++i) {
     nF=aMF(i);
     iRankF=myDS->Rank(nF);
-    const TopoDS_Shape& aF=myDS->Shape(nF);
+    const TopoDS_Shape aF=myDS->Shape(nF);
     aExp.Init(aF, TopAbs_EDGE);
     for(; aExp.More();  aExp.Next()) {
       aE=TopoDS::Edge(aExp.Current());