1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0026385: Fix to prevent BRepMesh from possible crash due to pointer to local variable stored inside Extrema_LocateExtPC

Made the BRepAdaptor_Curve a member of BRepMesh_EdgeParameterProvider to ensure that it is created before and destroyed after the Extrema_LocateExtPC that uses it.
This commit is contained in:
abelcsik
2015-07-02 16:30:57 +02:00
committed by bugmaster
parent 8948e7784a
commit 51aed73084
2 changed files with 6 additions and 4 deletions

View File

@@ -32,7 +32,8 @@ BRepMesh_EdgeParameterProvider::BRepMesh_EdgeParameterProvider(
const Handle(TColStd_HArray1OfReal)& theParameters)
: myParameters(theParameters),
myIsSameParam(BRep_Tool::SameParameter(theEdge)),
myScale(1.)
myScale(1.),
myCurveAdaptor(theEdge, theFace)
{
if (myIsSameParam)
return;
@@ -58,9 +59,8 @@ BRepMesh_EdgeParameterProvider::BRepMesh_EdgeParameterProvider(
(aOldLastParam - myOldFirstParam);
}
BRepAdaptor_Curve aCOnS(theEdge, theFace);
myProjector.Initialize(aCOnS, aCOnS.FirstParameter(),
aCOnS.LastParameter(), Precision::PConfusion());
myProjector.Initialize(myCurveAdaptor, myCurveAdaptor.FirstParameter(),
myCurveAdaptor.LastParameter(), Precision::PConfusion());
}
//=======================================================================

View File

@@ -20,6 +20,7 @@
#include <Standard_DefineAlloc.hxx>
#include <Extrema_LocateExtPC.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <BRepAdaptor_Curve.hxx>
class gp_Pnt;
class TopoDS_Edge;
@@ -63,6 +64,7 @@ private:
Standard_Real myCurParam;
Standard_Real myFoundParam;
BRepAdaptor_Curve myCurveAdaptor;
Extrema_LocateExtPC myProjector;
};