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()) { for (; aIt.More(); aIt.Next()) {
Handle(BOPDS_PaveBlock)& aPB=aIt.ChangeValue(); Handle(BOPDS_PaveBlock)& aPB=aIt.ChangeValue();
// //
const Handle(BOPDS_PaveBlock)& aPBR=aPB->RealPaveBlock(); const Handle(BOPDS_PaveBlock) aPBR=aPB->RealPaveBlock();
if (aMPBF.Contains(aPBR)) { if (aMPBF.Contains(aPBR)) {
continue; continue;
} }

View File

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

View File

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

View File

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

View File

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