mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-25 17:00:35 +05:00
Some protection from usage of removed objects whose data label
is reused by a new object
This commit is contained in:
parent
6ca2a7408c
commit
4e2d22a173
@ -462,7 +462,12 @@ bool GEOM_Engine::RemoveObject(Handle(GEOM_BaseObject)& theObject)
|
||||
|
||||
//Remove an object from the map of available objects
|
||||
TCollection_AsciiString anID = BuildIDFromObject(theObject);
|
||||
if (_objects.IsBound(anID)) _objects.UnBind(anID);
|
||||
if (_objects.IsBound(anID)) {
|
||||
Handle(GEOM_BaseObject) anObject = Handle(GEOM_BaseObject)::DownCast(_objects(anID));
|
||||
if ( anObject != theObject )
|
||||
anObject->_label = anObject->_label.Root();
|
||||
_objects.UnBind(anID);
|
||||
}
|
||||
|
||||
// If sub-shape, remove it from the list of sub-shapes of its main shape
|
||||
Handle(GEOM_Object) aGO = Handle(GEOM_Object)::DownCast( theObject );
|
||||
@ -491,6 +496,13 @@ bool GEOM_Engine::RemoveObject(Handle(GEOM_BaseObject)& theObject)
|
||||
if ( aFreeLabels.empty() || aFreeLabels.back() != aLabel )
|
||||
aFreeLabels.push_back(aLabel);
|
||||
|
||||
// we can't explicitely delete theObject. At least prevent its functioning
|
||||
// as an alive object when aLabel is reused for a new object
|
||||
theObject->_label = aLabel.Root();
|
||||
theObject->_ior.Clear();
|
||||
theObject->_parameters.Clear();
|
||||
theObject->_docID = -1;
|
||||
|
||||
theObject.Nullify();
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user