mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0023901: Memory leaks in tests.
1. Removed cyclic reference. Removed field myCommonBlock from BOPDS_PaveBlock; 2. Added data map myMapPBCB in BOPDS_DS. It contains pairs (PaveBlock, CommonBlock); 3. All methods about common block have been shifted from BOPDS_PaveBlock to BOPDS_DS; 4. Test case bugs moddata_2 pro19422_2 has been rewritten to build the correct result. Test case corrected (TODO removed)
This commit is contained in:
@@ -92,14 +92,14 @@
|
||||
aItPB.Initialize(aLPB);
|
||||
for (; aItPB.More(); aItPB.Next()) {
|
||||
const Handle(BOPDS_PaveBlock)& aPB=aItPB.Value();
|
||||
const Handle(BOPDS_PaveBlock)& aPBR=aPB->RealPaveBlock();
|
||||
const Handle(BOPDS_PaveBlock)& aPBR=myDS->RealPaveBlock(aPB);
|
||||
//
|
||||
nSpR=aPBR->Edge();
|
||||
const TopoDS_Shape& aSpR=myDS->Shape(nSpR);
|
||||
aLS.Append(aSpR);
|
||||
myOrigins.Bind(aSpR, aE);
|
||||
//
|
||||
if (aPB->IsCommonBlockOnEdge()) {
|
||||
if (myDS->IsCommonBlockOnEdge(aPB)) {
|
||||
nSp=aPB->Edge();
|
||||
const TopoDS_Shape& aSp=myDS->Shape(nSp);
|
||||
myShapesSD.Bind(aSp, aSpR);
|
||||
|
@@ -327,7 +327,7 @@
|
||||
//=========================================
|
||||
// post treatment
|
||||
//=========================================
|
||||
BOPAlgo_Tools::PerformCommonBlocks(aMPBLPB, aAllocator);
|
||||
BOPAlgo_Tools::PerformCommonBlocks(aMPBLPB, aAllocator, myDS);
|
||||
PerformVerticesEE(aMVCPB, aAllocator);
|
||||
//-----------------------------------------------------scope t
|
||||
aMPBLPB.Clear();
|
||||
@@ -457,11 +457,11 @@
|
||||
Handle(BOPDS_PaveBlock) aPB=aMPBLI.FindKey(i);
|
||||
nE=aPB->OriginalEdge();
|
||||
// 3
|
||||
if (!aPB->IsCommonBlock()) {
|
||||
if (!myDS->IsCommonBlock(aPB)) {
|
||||
myDS->UpdatePaveBlock(aPB);
|
||||
}
|
||||
else {
|
||||
const Handle(BOPDS_CommonBlock)& aCB=aPB->CommonBlock();
|
||||
const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
|
||||
myDS->UpdateCommonBlock(aCB);
|
||||
}
|
||||
}//for (; aItMPBLI.More(); aItMPBLI.Next()) {
|
||||
|
@@ -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=myDS->RealPaveBlock(aPB);
|
||||
if (aMPBF.Contains(aPBR)) {
|
||||
continue;
|
||||
}
|
||||
@@ -293,7 +293,7 @@
|
||||
//=========================================
|
||||
// post treatment
|
||||
//=========================================
|
||||
BOPAlgo_Tools::PerformCommonBlocks(aMPBLI, aAllocator);
|
||||
BOPAlgo_Tools::PerformCommonBlocks(aMPBLI, aAllocator, myDS);
|
||||
PerformVerticesEF(aMVCPB, aAllocator);
|
||||
//
|
||||
// Update FaceInfoIn for all faces having EF common parts
|
||||
@@ -438,11 +438,11 @@
|
||||
Handle(BOPDS_PaveBlock) aPB=aMPBLI.FindKey(i);
|
||||
nE=aPB->OriginalEdge();
|
||||
// 3
|
||||
if (!aPB->IsCommonBlock()) {
|
||||
if (!myDS->IsCommonBlock(aPB)) {
|
||||
myDS->UpdatePaveBlock(aPB);
|
||||
}
|
||||
else {
|
||||
const Handle(BOPDS_CommonBlock)& aCB=aPB->CommonBlock();
|
||||
const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
|
||||
myDS->UpdateCommonBlock(aCB);
|
||||
}
|
||||
}//for (; aItMPBLI.More(); aItMPBLI.Next()) {
|
||||
|
@@ -386,7 +386,7 @@ static void ToleranceFF(const TopoDS_Face& aF1,
|
||||
if (bExist) {
|
||||
if (aMPBAdd.Add(aPBOut)) {
|
||||
Standard_Boolean bInBothFaces = Standard_True;
|
||||
if (!aPBOut->IsCommonBlock()) {
|
||||
if (!myDS->IsCommonBlock(aPBOut)) {
|
||||
Standard_Integer nE;
|
||||
Standard_Real aTolE;
|
||||
//
|
||||
@@ -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=aPDS->RealPaveBlock(aPBx);
|
||||
//
|
||||
// update vertices of paves
|
||||
aPave[0]=aPBx->Pave1();
|
||||
@@ -1713,7 +1713,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
|
||||
BOPDS_IndexedMapOfPaveBlock& aMPBIn2 = aFI2.ChangePaveBlocksIn();
|
||||
//
|
||||
// remove old pave blocks
|
||||
const Handle(BOPDS_CommonBlock)& aCB1 = aPBf->CommonBlock();
|
||||
const Handle(BOPDS_CommonBlock)& aCB1 = myDS->CommonBlock(aPBf);
|
||||
bCB = !aCB1.IsNull();
|
||||
BOPDS_ListOfPaveBlock aLPB1;
|
||||
//
|
||||
@@ -1757,7 +1757,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
|
||||
aPB2n->SetEdge(aPB->Edge());
|
||||
aPB2n->SetOriginalEdge(nE);
|
||||
aCB->AddPaveBlock(aPB2n);
|
||||
aPB2n->SetCommonBlock(aCB);
|
||||
myDS->SetCommonBlock(aPB2n, aCB);
|
||||
myDS->ChangePaveBlocks(nE).Append(aPB2n);
|
||||
}
|
||||
aCB->AddFaces(aFaces);
|
||||
@@ -1781,7 +1781,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
|
||||
Standard_Boolean bCom = BOPTools_AlgoTools::IsBlockInOnFace(aShrR, aF, aE, myContext);
|
||||
if (bCom) {
|
||||
if (bCB) {
|
||||
aCB = aPB->CommonBlock();
|
||||
aCB = myDS->CommonBlock(aPB);
|
||||
aCB->AddFace(nF);
|
||||
} else {
|
||||
aCB = new BOPDS_CommonBlock;
|
||||
@@ -1789,7 +1789,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
|
||||
aCB->AddFace(nF1);
|
||||
aCB->AddFace(nF2);
|
||||
//
|
||||
aPB->SetCommonBlock(aCB);
|
||||
myDS->SetCommonBlock(aPB, aCB);
|
||||
}
|
||||
aMPB.Add(aPB);
|
||||
}
|
||||
|
@@ -120,7 +120,7 @@ static void UpdateVertices(const TopoDS_Edge& aE,
|
||||
aItPB.Initialize(aLPB);
|
||||
for (; aItPB.More(); aItPB.Next()) {
|
||||
aPB=aItPB.Value();
|
||||
const Handle(BOPDS_CommonBlock)& aCB=aPB->CommonBlock();
|
||||
const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
|
||||
bCB=!aCB.IsNull();
|
||||
if (bCB) {
|
||||
myDS->SortPaveBlocks(aCB);
|
||||
@@ -207,7 +207,7 @@ static void UpdateVertices(const TopoDS_Edge& aE,
|
||||
aItMPB.Initialize(aMPBOn);
|
||||
for(; aItMPB.More(); aItMPB.Next()) {
|
||||
const Handle(BOPDS_PaveBlock)& aPB=aItMPB.Value();
|
||||
if (aPB->IsCommonBlockOnEdge()) {
|
||||
if (myDS->IsCommonBlockOnEdge(aPB)) {
|
||||
nE=aPB->Edge();
|
||||
const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&myDS->Shape(nE)));
|
||||
//
|
||||
@@ -289,7 +289,7 @@ static void UpdateVertices(const TopoDS_Edge& aE,
|
||||
bV2=myDS->IsNewShape(nV2);
|
||||
//
|
||||
if (!(bV1 || bV2)) {
|
||||
if (!aPB->IsCommonBlock()) {
|
||||
if (!myDS->IsCommonBlock(aPB)) {
|
||||
// the PB seems to be untouced
|
||||
aLPB.Clear();
|
||||
continue;
|
||||
|
@@ -25,6 +25,7 @@ uses
|
||||
BaseAllocator from BOPCol,
|
||||
IndexedDataMapOfIntegerListOfInteger from BOPCol,
|
||||
DataMapOfIntegerListOfInteger from BOPCol,
|
||||
PDS from BOPDS,
|
||||
PaveBlock from BOPDS,
|
||||
IndexedDataMapOfPaveBlockListOfInteger from BOPDS,
|
||||
IndexedDataMapOfPaveBlockListOfPaveBlock from BOPDS,
|
||||
@@ -47,7 +48,8 @@ is
|
||||
|
||||
PerformCommonBlocks(myclass;
|
||||
theMBlocks :out IndexedDataMapOfPaveBlockListOfPaveBlock from BOPDS;
|
||||
theAllocator:out BaseAllocator from BOPCol);
|
||||
theAllocator:out BaseAllocator from BOPCol;
|
||||
pDS: out PDS from BOPDS);
|
||||
|
||||
FillMap(myclass;
|
||||
tneN1:Integer from Standard;
|
||||
@@ -70,7 +72,8 @@ is
|
||||
|
||||
PerformCommonBlocks(myclass;
|
||||
theMBlocks :IndexedDataMapOfPaveBlockListOfInteger from BOPDS;
|
||||
theAllocator:out BaseAllocator from BOPCol);
|
||||
theAllocator:out BaseAllocator from BOPCol;
|
||||
pDS: out PDS from BOPDS);
|
||||
--fields
|
||||
|
||||
end Tools;
|
||||
|
@@ -17,6 +17,7 @@
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
#include <BOPAlgo_Tools.ixx>
|
||||
#include <BOPDS_DS.hxx>
|
||||
#include <BOPDS_MapOfPaveBlock.hxx>
|
||||
#include <BOPDS_IndexedMapOfPaveBlock.hxx>
|
||||
#include <BOPDS_CommonBlock.hxx>
|
||||
@@ -265,7 +266,8 @@
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_Tools::PerformCommonBlocks(BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock& aMPBLPB,
|
||||
Handle(NCollection_BaseAllocator)& aAllocator)
|
||||
Handle(NCollection_BaseAllocator)& aAllocator,
|
||||
BOPDS_PDS& pDS)
|
||||
{
|
||||
Standard_Integer aNbCB;
|
||||
//
|
||||
@@ -297,7 +299,7 @@
|
||||
aItLPB.Initialize(aLPB);
|
||||
for (; aItLPB.More(); aItLPB.Next()) {
|
||||
const Handle(BOPDS_PaveBlock)& aPBx=aItLPB.Value();
|
||||
aPBx->SetCommonBlock(aCB);
|
||||
pDS->SetCommonBlock(aPBx, aCB);
|
||||
}
|
||||
}//if (aNbPB>1) {
|
||||
}
|
||||
@@ -307,7 +309,8 @@
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_Tools::PerformCommonBlocks(const BOPDS_IndexedDataMapOfPaveBlockListOfInteger& aMPBLI,
|
||||
Handle(NCollection_BaseAllocator)& )//aAllocator)
|
||||
Handle(NCollection_BaseAllocator)& ,//aAllocator
|
||||
BOPDS_PDS& pDS)
|
||||
{
|
||||
Standard_Integer nF, i, aNb;
|
||||
BOPCol_ListIteratorOfListOfInteger aItLI;
|
||||
@@ -317,8 +320,8 @@
|
||||
aNb=aMPBLI.Extent();
|
||||
for (i=1; i<=aNb; ++i) {
|
||||
aPB=aMPBLI.FindKey(i);
|
||||
if (aPB->IsCommonBlock()) {
|
||||
aCB=aPB->CommonBlock();
|
||||
if (pDS->IsCommonBlock(aPB)) {
|
||||
aCB=pDS->CommonBlock(aPB);
|
||||
}
|
||||
else {
|
||||
aCB=new BOPDS_CommonBlock;
|
||||
@@ -331,6 +334,6 @@
|
||||
nF=aItLI.Value();
|
||||
aCB->AddFace(nF);
|
||||
}
|
||||
aPB->SetCommonBlock(aCB);
|
||||
pDS->SetCommonBlock(aPB, aCB);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user