mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +03:00
0032044: Foundation Classes - NCollection_Array2::Resize() does not allocate pointer array
NCollection_Array2::Resize() has been fixed to set myDeletable before calling Allocate().
This commit is contained in:
parent
4b52faa56f
commit
0f26ed5476
@ -349,10 +349,11 @@ public:
|
||||
}
|
||||
delete[] aTableOld;
|
||||
|
||||
const Standard_Boolean wasDeletable = myDeletable;
|
||||
myDeletable = Standard_True;
|
||||
Allocate();
|
||||
if (!theToCopyData)
|
||||
{
|
||||
myDeletable = Standard_True;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -366,11 +367,10 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
if (myDeletable)
|
||||
if (wasDeletable)
|
||||
{
|
||||
delete[] aStartOld;
|
||||
}
|
||||
myDeletable = Standard_True;
|
||||
}
|
||||
|
||||
//! Destructor - releases the memory
|
||||
|
@ -193,6 +193,8 @@ static void TestArray2 (QANCollection_Array2Func& theA2)
|
||||
Handle(QANCollection_HArray2Func) aHa = new QANCollection_HArray2Func(aCArr);
|
||||
// Assign
|
||||
AssignCollection (aHa->ChangeArray2(), theA2);
|
||||
|
||||
delete[] rBlock;
|
||||
}
|
||||
|
||||
// ===================== Test methods of List type ==========================
|
||||
@ -755,8 +757,17 @@ static Standard_Integer QANColTestArray2(Draw_Interpretor& di, Standard_Integer
|
||||
}
|
||||
}
|
||||
|
||||
QANCollection_Array2Func anArr2Copy2 = anArr2;
|
||||
anArr2Copy2.Resize (LowerRow - 1, UpperRow - 1, LowerCol + 1, UpperCol + 1, false);
|
||||
{
|
||||
QANCollection_Array2Func anArr2Copy2 = anArr2;
|
||||
anArr2Copy2.Resize (LowerRow - 1, UpperRow - 1, LowerCol + 1, UpperCol + 1, false);
|
||||
}
|
||||
|
||||
{
|
||||
// empty array resize
|
||||
QANCollection_Array2Func anArr2Copy3;
|
||||
anArr2Copy3.Resize (LowerRow, UpperRow, LowerCol, UpperCol, false);
|
||||
anArr2Copy3 = anArr2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user