//==================================================================================================
GeomAlgoAPI_Intersection::GeomAlgoAPI_Intersection(const ListOfShape& theObjects)
+ : myFiller(0)
{
build(theObjects);
}
+GeomAlgoAPI_Intersection::~GeomAlgoAPI_Intersection() {
+ if (myFiller)
+ delete (BOPAlgo_PaveFiller*)myFiller;
+}
//==================================================================================================
void GeomAlgoAPI_Intersection::build(const ListOfShape& theObjects)
{
}
}
- BOPAlgo_PaveFiller aDSFiller;
- aDSFiller.SetArguments(anObjects);
+ BOPAlgo_PaveFiller* aDSFiller = new BOPAlgo_PaveFiller;
+ myFiller = aDSFiller;
+ aDSFiller->SetArguments(anObjects);
- aDSFiller.SetRunParallel(false);
- aDSFiller.SetNonDestructive(false);
- aDSFiller.SetGlue(BOPAlgo_GlueOff);
+ aDSFiller->SetRunParallel(false);
+ aDSFiller->SetNonDestructive(false);
+ aDSFiller->SetGlue(BOPAlgo_GlueOff);
// optimization for the issue #2399
BOPAlgo_SectionAttribute theSecAttr(Standard_True,
Standard_True,
Standard_True);
- aDSFiller.SetSectionAttribute(theSecAttr);
+ aDSFiller->SetSectionAttribute(theSecAttr);
- aDSFiller.Perform();
- if (aDSFiller.HasErrors()) {
+ aDSFiller->Perform();
+ if (aDSFiller->HasErrors()) {
return;
}
anOperation->SetRunParallel(false);
anOperation->SetCheckInverted(true);
- anOperation->PerformWithFiller(aDSFiller);
+ anOperation->PerformWithFiller(*aDSFiller); // it references a filler fields, so keep the filler
if(anOperation->HasErrors()) {
return;
}
/// \brief Performs the intersection operations.
class GeomAlgoAPI_Intersection : public GeomAlgoAPI_MakeShape
{
+ void* myFiller; ///< store filler to avoid memory leaks
public:
/// \brief Constructor.
/// \param[in] theObjects list of objects.
/// \param[in] theTools list of tools.
GEOMALGOAPI_EXPORT GeomAlgoAPI_Intersection(const ListOfShape& theObjects);
+ /// Destructor to erase the filler
+ GEOMALGOAPI_EXPORT virtual ~GeomAlgoAPI_Intersection();
+
private:
/// Builds resulting shape.
void build(const ListOfShape& theObjects);
+
};
#endif