]> OCCT Git - occt-copy.git/commitdiff
0023901: Memory leaks in tests
authoromy <omy@opencascade.com>
Wed, 17 Apr 2013 13:15:29 +0000 (17:15 +0400)
committeromy <omy@opencascade.com>
Wed, 17 Apr 2013 13:15:29 +0000 (17:15 +0400)
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.

src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx
src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx
src/BOPDS/BOPDS_DS.cxx
src/BOPDS/BOPDS_PaveBlock.cdl
src/BOPDS/BOPDS_PaveBlock.cxx

index b8c10af16e66f9f37c40529e474cee84287c761b..ed1d6363ae0747a07fcaf1ca9adc766dfbed9e2f 100644 (file)
     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;
       }
index 2968be3bbad4665893fe2a4fa770095236225f95..dc28673b1fa05dbdf892395a7a45618869abe31e 100644 (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();
index dadc6516ffad6480cd08e9d935c5797c82302e50..897c220b72347f0cd0ad0432caeaeacb1c02e42b 100644 (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
@@ -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);
index c69cc6f042f872fde75b9da62fb44968405210a0..c7ecade1dba4a3e4d9e8ef9f909efa528341a4ba 100644 (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;
index bb604b88aa8064d7ed45f3ce5eca62774c51a373..01c3107e6f70bd5a1f626ffdc05d77126805708a 100644 (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
 //=======================================================================