From: omy Date: Wed, 17 Apr 2013 13:15:29 +0000 (+0400) Subject: 0023901: Memory leaks in tests X-Git-Tag: V6_6_0~10 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=323c04defa3a2382a07df17a7d793ce05d73aa43;p=occt-copy.git 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. --- diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx index b8c10af16e..ed1d6363ae 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx @@ -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; } diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx index 2968be3bba..dc28673b1f 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx @@ -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(); diff --git a/src/BOPDS/BOPDS_DS.cxx b/src/BOPDS/BOPDS_DS.cxx index dadc6516ff..897c220b72 100644 --- a/src/BOPDS/BOPDS_DS.cxx +++ b/src/BOPDS/BOPDS_DS.cxx @@ -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 @@ -772,11 +769,10 @@ static aPB->AppendExtPave1(aPave); } // - iRef=myPaveBlocksPool.Append()-1; + iRef = myPaveBlocksPool.Append() - 1; 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); diff --git a/src/BOPDS/BOPDS_PaveBlock.cdl b/src/BOPDS/BOPDS_PaveBlock.cdl index c69cc6f042..c7ecade1db 100644 --- a/src/BOPDS/BOPDS_PaveBlock.cdl +++ b/src/BOPDS/BOPDS_PaveBlock.cdl @@ -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; diff --git a/src/BOPDS/BOPDS_PaveBlock.cxx b/src/BOPDS/BOPDS_PaveBlock.cxx index bb604b88aa..01c3107e6f 100644 --- a/src/BOPDS/BOPDS_PaveBlock.cxx +++ b/src/BOPDS/BOPDS_PaveBlock.cxx @@ -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 //=======================================================================