From dad7fede3945ee013c141bcdb9769c9ca5d822de Mon Sep 17 00:00:00 2001 From: kgv Date: Tue, 30 Jun 2020 18:48:36 +0300 Subject: [PATCH] 0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying edge in AIS_Shape Fixed unexpected calling of PrsMgr_Presentation::Erase() from Graphic3d_Structure::SetVisual(). --- src/Graphic3d/Graphic3d_Structure.cxx | 10 +++++----- src/Graphic3d/Graphic3d_Structure.hxx | 16 ++++++++++++---- src/PrsMgr/PrsMgr_Presentation.cxx | 14 +++++++------- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/Graphic3d/Graphic3d_Structure.cxx b/src/Graphic3d/Graphic3d_Structure.cxx index e165e7100c..c021facc4b 100644 --- a/src/Graphic3d/Graphic3d_Structure.cxx +++ b/src/Graphic3d/Graphic3d_Structure.cxx @@ -73,10 +73,10 @@ Graphic3d_Structure::~Graphic3d_Structure() } //============================================================================= -//function : Clear +//function : clear //purpose : //============================================================================= -void Graphic3d_Structure::Clear (const Standard_Boolean theWithDestruction) +void Graphic3d_Structure::clear (const Standard_Boolean theWithDestruction) { if (IsDeleted()) return; @@ -206,10 +206,10 @@ void Graphic3d_Structure::ResetDisplayPriority() } //============================================================================= -//function : Erase +//function : erase //purpose : //============================================================================= -void Graphic3d_Structure::Erase() +void Graphic3d_Structure::erase() { if (IsDeleted()) { @@ -431,7 +431,7 @@ void Graphic3d_Structure::SetVisual (const Graphic3d_TypeOfStructure theVisual) } else { - Erase(); + erase(); myVisual = theVisual; SetComputeVisual (theVisual); Display(); diff --git a/src/Graphic3d/Graphic3d_Structure.hxx b/src/Graphic3d/Graphic3d_Structure.hxx index 3812df9791..9739cbe092 100644 --- a/src/Graphic3d/Graphic3d_Structure.hxx +++ b/src/Graphic3d/Graphic3d_Structure.hxx @@ -66,7 +66,10 @@ public: //! The structure itself is conserved. //! The transformation and the attributes of are conserved. //! The childs of are conserved. - Standard_EXPORT virtual void Clear (const Standard_Boolean WithDestruction = Standard_True); + virtual void Clear (const Standard_Boolean WithDestruction = Standard_True) + { + clear (WithDestruction); + } //! Suppresses the structure . //! It will be erased at the next screen update. @@ -78,9 +81,8 @@ public: //! Returns the current display priority for this structure. Standard_Integer DisplayPriority() const { return myCStructure->Priority; } - //! Erases the structure in all the views - //! of the visualiser. - Standard_EXPORT virtual void Erase(); + //! Erases this structure in all the views of the visualiser. + virtual void Erase() { erase(); } //! Highlights the structure in all the views with the given style //! @param theStyle [in] the style (type of highlighting: box/color, color and opacity) @@ -428,6 +430,12 @@ protected: //! Removes the given ancestor structure. Standard_EXPORT Standard_Boolean RemoveAncestor (Graphic3d_Structure* theAncestor); + //! Clears all the groups of primitives in the structure. + Standard_EXPORT void clear (const Standard_Boolean WithDestruction); + + //! Erases this structure in all the views of the visualiser. + Standard_EXPORT void erase(); + private: //! Suppress in the structure , the group theGroup. diff --git a/src/PrsMgr/PrsMgr_Presentation.cxx b/src/PrsMgr/PrsMgr_Presentation.cxx index f28b9597be..c53573d46e 100644 --- a/src/PrsMgr/PrsMgr_Presentation.cxx +++ b/src/PrsMgr/PrsMgr_Presentation.cxx @@ -102,12 +102,12 @@ void PrsMgr_Presentation::Erase() } // Erase structure from structure manager - base_type::Erase(); - base_type::Clear(); + erase(); + clear (true); // Disconnect other structures - base_type::DisconnectAll (Graphic3d_TOC_DESCENDANT); + DisconnectAll (Graphic3d_TOC_DESCENDANT); // Clear groups and remove graphic structure - base_type::Remove(); + Remove(); } //======================================================================= @@ -140,7 +140,7 @@ void PrsMgr_Presentation::Unhighlight() base_type::SetVisible (Standard_False); break; case State_Empty: - base_type::Erase(); + base_type::erase(); break; } } @@ -162,8 +162,8 @@ void PrsMgr_Presentation::Clear (const Standard_Boolean theWithDestruction) return; } - base_type::Clear (theWithDestruction); - base_type::DisconnectAll (Graphic3d_TOC_DESCENDANT); + clear (theWithDestruction); + DisconnectAll (Graphic3d_TOC_DESCENDANT); } //======================================================================= -- 2.20.1