From: mpv Date: Tue, 3 Oct 2006 08:52:10 +0000 (+0000) Subject: MPV: fix for nug IPAL13251 X-Git-Tag: V3_2_3pre1~15 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e47799d70d8216a0703b0bb655ce7a4aadea7091;p=modules%2Fgeom.git MPV: fix for nug IPAL13251 "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. --- diff --git a/src/NMTTools/NMTTools_DEProcessor.cxx b/src/NMTTools/NMTTools_DEProcessor.cxx index 6762a1dd3..b394de328 100644 --- a/src/NMTTools/NMTTools_DEProcessor.cxx +++ b/src/NMTTools/NMTTools_DEProcessor.cxx @@ -137,14 +137,14 @@ 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); @@ -306,8 +306,8 @@ // 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); @@ -333,7 +333,7 @@ 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); // @@ -427,8 +427,8 @@ 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); diff --git a/src/NMTTools/NMTTools_PaveFiller_1.cxx b/src/NMTTools/NMTTools_PaveFiller_1.cxx index 57c923e77..448804477 100644 --- a/src/NMTTools/NMTTools_PaveFiller_1.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_1.cxx @@ -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); @@ -127,7 +127,7 @@ 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); diff --git a/src/NMTTools/NMTTools_PaveFiller_4.cxx b/src/NMTTools/NMTTools_PaveFiller_4.cxx index 33f178c92..fb8123077 100644 --- a/src/NMTTools/NMTTools_PaveFiller_4.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_4.cxx @@ -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); diff --git a/src/NMTTools/NMTTools_PaveFiller_5.cxx b/src/NMTTools/NMTTools_PaveFiller_5.cxx index db8930c00..a29f760ab 100644 --- a/src/NMTTools/NMTTools_PaveFiller_5.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_5.cxx @@ -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; diff --git a/src/NMTTools/NMTTools_PaveFiller_6.cxx b/src/NMTTools/NMTTools_PaveFiller_6.cxx index 8c4852a4b..3ad988b62 100644 --- a/src/NMTTools/NMTTools_PaveFiller_6.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_6.cxx @@ -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); diff --git a/src/NMTTools/NMTTools_PaveFiller_7.cxx b/src/NMTTools/NMTTools_PaveFiller_7.cxx index 50d899ad9..3c9d4f7ac 100644 --- a/src/NMTTools/NMTTools_PaveFiller_7.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_7.cxx @@ -236,7 +236,7 @@ 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());