mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-06-30 12:14:08 +03:00
0022788: Exception during closing of document due to corrupted memory
This commit is contained in:
parent
0ddd904c6a
commit
997cf5f22c
@ -193,20 +193,24 @@ static void RemoveNode(Standard_Boolean MapExist ,
|
||||
TNaming_Node* nextOld = N->nextSameOld;
|
||||
if (nextOld != 0L)
|
||||
pos->FirstUse(nextOld);
|
||||
else
|
||||
else {
|
||||
// le shape disparait
|
||||
if (MapExist){
|
||||
if (MapExist)
|
||||
M.UnBind(pos->Shape());
|
||||
#ifdef BUC60921
|
||||
//#ifdef BUC60921
|
||||
N->myOld = 0L;
|
||||
if(pos != N->myNew)
|
||||
{
|
||||
delete pos;
|
||||
#endif
|
||||
pos = 0L;
|
||||
}
|
||||
//#endif
|
||||
}
|
||||
}
|
||||
else {
|
||||
TNaming_Node* pdn = pos->FirstUse();
|
||||
while (pdn != 0L) {
|
||||
|
||||
if (pdn->NextSameShape(pos) == N) {
|
||||
if (pdn->myOld == pos) pdn->nextSameOld = N->nextSameOld;
|
||||
else pdn->nextSameNew = N->nextSameOld;
|
||||
@ -224,13 +228,17 @@ static void RemoveNode(Standard_Boolean MapExist ,
|
||||
if (nextNew != 0L)
|
||||
pns->FirstUse(nextNew);
|
||||
else
|
||||
{
|
||||
// le shape disparait
|
||||
if (MapExist) {
|
||||
if (MapExist)
|
||||
M.UnBind(pns->Shape());
|
||||
#ifdef BUC60921
|
||||
N->myNew = 0L;
|
||||
|
||||
pns->FirstUse(0L);
|
||||
delete pns;
|
||||
#endif
|
||||
pns = 0L;
|
||||
|
||||
N->myNew = 0L;
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -282,9 +290,12 @@ void TNaming_NamedShape::Clear()
|
||||
while (p != 0L) {
|
||||
q = p;
|
||||
p = p->nextSameAttribute;
|
||||
if( q !=0L)
|
||||
{
|
||||
delete q;
|
||||
q = 0L;
|
||||
}
|
||||
}
|
||||
|
||||
myNode = 0L;
|
||||
}
|
||||
@ -347,9 +358,12 @@ Standard_Boolean TNaming_NamedShape::AfterUndo
|
||||
while (p != 0L) {
|
||||
q = p;
|
||||
p = p->nextSameAttribute;
|
||||
if(q != 0L)
|
||||
{
|
||||
delete q;
|
||||
q = 0L;
|
||||
}
|
||||
}
|
||||
|
||||
myNode = 0L;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <TDF_DeltaOnAddition.hxx>
|
||||
#include <TNaming_DataMapIteratorOfDataMapOfShapePtrRefShape.hxx>
|
||||
#include <TNaming_RefShape.hxx>
|
||||
|
||||
#include <TNaming_PtrNode.hxx>
|
||||
#define BUC60862
|
||||
|
||||
#ifdef BUC60862
|
||||
@ -46,10 +46,6 @@ TNaming_UsedShapes::TNaming_UsedShapes()
|
||||
|
||||
void TNaming_UsedShapes::Destroy()
|
||||
{
|
||||
TNaming_DataMapIteratorOfDataMapOfShapePtrRefShape itr(myMap);
|
||||
for (; itr.More(); itr.Next()) {
|
||||
if(itr.Value() != NULL) delete itr.Value(); // <== szy: removed "//"
|
||||
}
|
||||
myMap.Clear();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user