1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00

0022738: Exception on destruction of Graphic3d_Structure

This commit is contained in:
APL 2011-09-30 06:56:53 +00:00 committed by bugmaster
parent 5e59c041fc
commit 6c8126b56f
3 changed files with 43 additions and 29 deletions

View File

@ -110,10 +110,17 @@
-- Category: Methods to modify the class definition
---------------------------------------------------
Clear ( me : mutable )
Clear ( me : mutable;
theUpdateStructureMgr : Boolean from Standard = Standard_True )
is static;
---Level: Public
---Purpose: Supress all primitives and attributes of <me>.
-- To clear group without update in Graphic3d_StructureManager
-- pass Standard_False as <theUpdateStructureMgr>. This
-- used on context and viewer destruction, when the pointer
-- to structure manager in Graphic3d_Structure could be
-- already released (pointers are used here to avoid handle
-- cross-reference);
---Category: Methods to modify the class definition
Destroy ( me : mutable )

View File

@ -27,40 +27,43 @@
//-Methods, in order
void Graphic3d_Group::Clear () {
void Graphic3d_Group::Clear (Standard_Boolean theUpdateStructureMgr)
{
if (IsDeleted ()) return;
if (IsDeleted ()) return;
MyCGroup.ContextLine.IsSet = 0,
MyCGroup.ContextText.IsSet = 0,
MyCGroup.ContextMarker.IsSet = 0,
MyCGroup.ContextFillArea.IsSet = 0;
MyCGroup.ContextLine.IsSet = 0,
MyCGroup.ContextText.IsSet = 0,
MyCGroup.ContextMarker.IsSet = 0,
MyCGroup.ContextFillArea.IsSet = 0;
MyCGroup.ContextLine.IsDef = 0,
MyCGroup.ContextText.IsDef = 0,
MyCGroup.ContextMarker.IsDef = 0,
MyCGroup.ContextFillArea.IsDef = 0;
MyCGroup.ContextLine.IsDef = 0,
MyCGroup.ContextText.IsDef = 0,
MyCGroup.ContextMarker.IsDef = 0,
MyCGroup.ContextFillArea.IsDef = 0;
MyCGroup.PickId.IsDef = 0,
MyCGroup.PickId.IsSet = 0,
MyCGroup.PickId.Value = 0;
MyCGroup.PickId.IsDef = 0,
MyCGroup.PickId.IsSet = 0,
MyCGroup.PickId.Value = 0;
MyBounds.XMin = ShortRealLast (),
MyBounds.YMin = ShortRealLast (),
MyBounds.ZMin = ShortRealLast ();
MyBounds.XMin = ShortRealLast (),
MyBounds.YMin = ShortRealLast (),
MyBounds.ZMin = ShortRealLast ();
MyBounds.XMax = ShortRealFirst (),
MyBounds.YMax = ShortRealFirst (),
MyBounds.ZMax = ShortRealFirst ();
MyBounds.XMax = ShortRealFirst (),
MyBounds.YMax = ShortRealFirst (),
MyBounds.ZMax = ShortRealFirst ();
if (MyContainsFacet) MyStructure->GroupsWithFacet (-1);
MyContainsFacet = Standard_False,
MyIsEmpty = Standard_True;
if (MyContainsFacet) MyStructure->GroupsWithFacet (-1);
MyContainsFacet = Standard_False,
MyIsEmpty = Standard_True;
MyGraphicDriver->ClearGroup (MyCGroup);
Update ();
MyGraphicDriver->ClearGroup (MyCGroup);
// clear method could be used on Graphic3d_Structure destruction,
// and its structure manager could be already destroyed, in that
// case we don't need to update it;
if (theUpdateStructureMgr)
Update ();
}
void Graphic3d_Group::Destroy () {

View File

@ -261,10 +261,14 @@ void Graphic3d_Structure::Remove () {
Standard_Integer i, Length;
// clean groups in graphics driver at first
// clean groups in graphics driver at first; this is also should be done
// to avoid unwanted group cleaning in group's destructor
// Pass Standard_False to Clear(..) method to avoid updating in
// structure manager, it isn't necessary, besides of it structure manager
// could be already destroyed and invalid pointers used in structure;
Length = MyGroups.Length();
for (Standard_Integer aGrId = 1; aGrId <= Length; ++aGrId)
MyGroups.ChangeValue (aGrId)->Clear();
MyGroups.ChangeValue (aGrId)->Clear (Standard_False);
// Standard_Address APtr = (void *) This ().operator->();
Standard_Address APtr = (void *) this;