22261: EDF 2698 SMESH: Memory leak when displaying 2D quadratic elements as arcs

Pb: myLimit leaks if it was not provided at construction
This commit is contained in:
eap 2013-07-24 14:49:27 +00:00
parent 8fe58da2fc
commit e11c322ee9

View File

@ -85,7 +85,7 @@ class SMESH_Tree
static int nbChildren() { return NB_CHILDREN; } static int nbChildren() { return NB_CHILDREN; }
// Compute the bigger dimension of my box // Compute the biggest dimension of my box
virtual double maxSize() const = 0; virtual double maxSize() const = 0;
protected: protected:
@ -141,7 +141,7 @@ SMESH_Tree<BND_BOX,NB_CHILDREN>::SMESH_Tree (SMESH_TreeLimit* limit):
myLevel(0), myLevel(0),
myBox(0) myBox(0)
{ {
if ( !myLimit ) myLimit = new SMESH_TreeLimit(); //if ( !myLimit ) myLimit = new SMESH_TreeLimit();
} }
//================================================================================ //================================================================================
@ -155,6 +155,7 @@ void SMESH_Tree<BND_BOX,NB_CHILDREN>::compute()
{ {
if ( myLevel==0 ) if ( myLevel==0 )
{ {
if ( !myLimit ) myLimit = new SMESH_TreeLimit();
myBox = buildRootBox(); myBox = buildRootBox();
if ( myLimit->myMinBoxSize > 0. && maxSize() <= myLimit->myMinBoxSize ) if ( myLimit->myMinBoxSize > 0. && maxSize() <= myLimit->myMinBoxSize )
myIsLeaf = true; myIsLeaf = true;