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

0023901: Memory leaks in tests

Removed a field from BOPDS_PaveBlock that contained  the BOPDS_PaveBlock object itself.
Function RealPaveBlock() now returns a const handle, not a const reference to handle.
Removed const modifier because function now returns an object, not a reference to it.
This commit is contained in:
omy
2013-04-17 17:15:29 +04:00
parent ed97f43c0c
commit 323c04defa
5 changed files with 8 additions and 17 deletions

View File

@@ -126,7 +126,7 @@
for (; aIt.More(); aIt.Next()) {
Handle(BOPDS_PaveBlock)& aPB=aIt.ChangeValue();
//
const Handle(BOPDS_PaveBlock)& aPBR=aPB->RealPaveBlock();
const Handle(BOPDS_PaveBlock) aPBR=aPB->RealPaveBlock();
if (aMPBF.Contains(aPBR)) {
continue;
}

View File

@@ -663,7 +663,7 @@ static void ToleranceFF(const TopoDS_Face& aF1,
}
for (; aItLPB.More(); aItLPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPBx=aItLPB.Value();
const Handle(BOPDS_PaveBlock)& aPBRx=aPBx->RealPaveBlock();
const Handle(BOPDS_PaveBlock) aPBRx=aPBx->RealPaveBlock();
//
// update vertices of paves
aPave[0]=aPBx->Pave1();

View File

@@ -705,7 +705,6 @@ static
{
Standard_Boolean bHasReference;
Standard_Integer aRef;
BOPDS_ListOfPaveBlock* pLPB;
//
BOPDS_ShapeInfo& aSI=ChangeShapeInfo(theI);
bHasReference=aSI.HasReference();
@@ -714,9 +713,7 @@ static
}
//
aRef=aSI.Reference();
const BOPDS_ListOfPaveBlock& aLPB=myPaveBlocksPool(aRef);
pLPB=(BOPDS_ListOfPaveBlock*)&aLPB;
return *pLPB;
return myPaveBlocksPool(aRef);
}
//=======================================================================
//function : InitPaveBlocks
@@ -776,7 +773,6 @@ static
BOPDS_ListOfPaveBlock &aLPB=myPaveBlocksPool(iRef);
//
aPB->Update(aLPB, Standard_False);
//
aSI.SetReference(iRef);
}
//=======================================================================
@@ -1363,7 +1359,7 @@ static
else {
aItLPB.Initialize(aLPB);
for (; aItLPB.More(); aItLPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPB=aItLPB.Value()->RealPaveBlock();
const Handle(BOPDS_PaveBlock) aPB=aItLPB.Value()->RealPaveBlock();
nSp=aPB->Edge();
aMI.Add(nSp);
}
@@ -1387,7 +1383,7 @@ static
else {
aItLPB.Initialize(aLPB);
for (; aItLPB.More(); aItLPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPB=aItLPB.Value()->RealPaveBlock();
const Handle(BOPDS_PaveBlock) aPB=aItLPB.Value()->RealPaveBlock();
nSp=aPB->Edge();
if (aMI.Contains(nSp)) {
theLI.Append(nSp);

View File

@@ -230,7 +230,6 @@ is
RealPaveBlock(me)
returns PaveBlock from BOPDS;
---C++: return const &
---Purpose:
--- Selector
--- Returns the real common block
@@ -283,7 +282,6 @@ fields
myTS2 : Real from Standard is protected;
myShrunkBox : Box from Bnd is protected;
--dummies
myPB : PaveBlock from BOPDS is protected;
myMFence : MapOfInteger from BOPCol is protected;
end PaveBlock;

View File

@@ -398,16 +398,13 @@ void SortShell(const int n, BOPDS_Pave *a)
//function : RealPaveBlock
//purpose :
//=======================================================================
const Handle(BOPDS_PaveBlock)& BOPDS_PaveBlock::RealPaveBlock()const
Handle(BOPDS_PaveBlock) BOPDS_PaveBlock::RealPaveBlock()const
{
if (IsCommonBlock()) {
const Handle(BOPDS_PaveBlock)& aPB1=myCommonBlock->PaveBlock1();
return aPB1;
}
//
Handle_BOPDS_PaveBlock* pPB=(Handle_BOPDS_PaveBlock*)&myPB;
*pPB=this;
return myPB;
return this;
}
// ShrunkData
//=======================================================================