From: eap Date: Wed, 29 Mar 2017 11:05:00 +0000 (+0300) Subject: Fix SIGSEGV at SALOME termination after performing SALOME_TESTS/Grids/smesh/imps_05/F0 X-Git-Tag: V8_3_0rc1~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e2ed82ab76826fe71cb635add1926e389c2fff9f;p=modules%2Fsmesh.git Fix SIGSEGV at SALOME termination after performing SALOME_TESTS/Grids/smesh/imps_05/F0 --- diff --git a/doc/salome/gui/SMESH/input/skew.doc b/doc/salome/gui/SMESH/input/skew.doc index 036c70d83..01f3c5fea 100644 --- a/doc/salome/gui/SMESH/input/skew.doc +++ b/doc/salome/gui/SMESH/input/skew.doc @@ -3,8 +3,8 @@ \page skew_page Skew \n \b Skew mesh quality criterion reflects the angle between the lines -that join opposite sides of a quadrangle element or the greatesr angle -between three medians in triangle elements. This mesh quality +that join opposite sides of a quadrangle element or the greatest angle +between a median and a midline in a triangle element. This mesh quality criterion can be applied to elements composed of 4 and 3 nodes (quadrangles and triangles). diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt index da52e0783..d2801c905 100755 --- a/resources/CMakeLists.txt +++ b/resources/CMakeLists.txt @@ -226,6 +226,8 @@ SET(SMESH_RESOURCES_FILES mesh_extmeth_surf_offset_smooth.png mesh_extmeth_face_offset.png mesh_quality.png + mesh_show.png + mesh_hide.png ) INSTALL(FILES ${SMESH_RESOURCES_FILES} DESTINATION ${SALOME_SMESH_INSTALL_RES_DATA}) diff --git a/resources/mesh_hide.png b/resources/mesh_hide.png new file mode 100644 index 000000000..31c505d82 Binary files /dev/null and b/resources/mesh_hide.png differ diff --git a/resources/mesh_show.png b/resources/mesh_show.png new file mode 100644 index 000000000..61ebe4703 Binary files /dev/null and b/resources/mesh_show.png differ diff --git a/src/SMESH/SMESH_Gen.cxx b/src/SMESH/SMESH_Gen.cxx index f9a89fed7..bd5654c89 100644 --- a/src/SMESH/SMESH_Gen.cxx +++ b/src/SMESH/SMESH_Gen.cxx @@ -73,6 +73,19 @@ SMESH_Gen::SMESH_Gen() //vtkDebugLeaks::SetExitError(0); } +namespace +{ + // a structure used to nullify SMESH_Gen field of SMESH_Hypothesis, + // which is needed for SMESH_Hypothesis not deleted before ~SMESH_Gen() + struct _Hyp : public SMESH_Hypothesis + { + void NullifyGen() + { + _gen = 0; + } + }; +} + //============================================================================= /*! * Destructor @@ -84,9 +97,16 @@ SMESH_Gen::~SMESH_Gen() std::map < int, StudyContextStruct * >::iterator i_sc = _mapStudyContext.begin(); for ( ; i_sc != _mapStudyContext.end(); ++i_sc ) { - delete i_sc->second->myDocument; - delete i_sc->second; - } + StudyContextStruct* context = i_sc->second; + std::map < int, SMESH_Hypothesis * >::iterator i_hyp = context->mapHypothesis.begin(); + for ( ; i_hyp != context->mapHypothesis.end(); ++i_hyp ) + { + if ( _Hyp* h = static_cast< _Hyp*>( i_hyp->second )) + h->NullifyGen(); + } + delete context->myDocument; + delete context; + } } //============================================================================= diff --git a/src/SMESH/SMESH_Hypothesis.cxx b/src/SMESH/SMESH_Hypothesis.cxx index 2d1e10c16..c4107fb38 100644 --- a/src/SMESH/SMESH_Hypothesis.cxx +++ b/src/SMESH/SMESH_Hypothesis.cxx @@ -25,20 +25,18 @@ // Author : Paul RASCLE, EDF // Module : SMESH // -#include "SMESH_Hypothesis.hxx" -#include "SMESHDS_Mesh.hxx" #include "SMESH_Gen.hxx" -#include "SMESH_Mesh.hxx" -#include "SMESH_subMesh.hxx" -#include "utilities.h" +#include "SMESHDS_Mesh.hxx" +#include "SMESH_Hypothesis.hxx" +#include "SMESH_Mesh.hxx" using namespace std; //============================================================================= /*! - * + * */ //============================================================================= @@ -63,8 +61,11 @@ SMESH_Hypothesis::SMESH_Hypothesis(int hypId, SMESH_Hypothesis::~SMESH_Hypothesis() { - StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId); - myStudyContext->mapHypothesis[_hypId] = 0; + if ( _gen ) + { + StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId); + myStudyContext->mapHypothesis[_hypId] = 0; + } } //============================================================================= @@ -77,20 +78,20 @@ int SMESH_Hypothesis::GetDim() const { int dim = 0; switch (_type) - { - case ALGO_1D: dim = 1; break; - case ALGO_2D: dim = 2; break; - case ALGO_3D: dim = 3; break; - case ALGO_0D: dim = 0; break; - case PARAM_ALGO: - dim = ( _param_algo_dim < 0 ) ? -_param_algo_dim : _param_algo_dim; break; - } + { + case ALGO_1D: dim = 1; break; + case ALGO_2D: dim = 2; break; + case ALGO_3D: dim = 3; break; + case ALGO_0D: dim = 0; break; + case PARAM_ALGO: + dim = ( _param_algo_dim < 0 ) ? -_param_algo_dim : _param_algo_dim; break; + } return dim; } //============================================================================= /*! - * + * */ //============================================================================= diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 0f08808d0..526b6c650 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -4020,8 +4020,8 @@ void SMESHGUI::initialize( CAM_Application* app ) createSMESHAction( SMESHOp::OpPropertiesArea, "MEASURE_AREA", "ICON_MEASURE_AREA" ); createSMESHAction( SMESHOp::OpPropertiesVolume, "MEASURE_VOLUME", "ICON_MEASURE_VOLUME" ); - createSMESHAction( SMESHOp::OpHide, "HIDE" ); - createSMESHAction( SMESHOp::OpShow, "SHOW" ); + createSMESHAction( SMESHOp::OpHide, "HIDE", "ICON_HIDE" ); + createSMESHAction( SMESHOp::OpShow, "SHOW", "ICON_SHOW" ); createSMESHAction( SMESHOp::OpShowOnly, "DISPLAY_ONLY" ); createSMESHAction( SMESHOp::OpSortChild, "SORT_CHILD_ITEMS" ); diff --git a/src/SMESHGUI/SMESH_images.ts b/src/SMESHGUI/SMESH_images.ts index fde04d78c..9531e409f 100644 --- a/src/SMESHGUI/SMESH_images.ts +++ b/src/SMESHGUI/SMESH_images.ts @@ -631,5 +631,13 @@ ICON_MEASURE_BND_BOX mesh_bounding_box.png + + ICON_SHOW + mesh_show.png + + + ICON_HIDE + mesh_hide.png + diff --git a/src/SMESHUtils/SMESH_TypeDefs.hxx b/src/SMESHUtils/SMESH_TypeDefs.hxx index 77c095cc1..c9be990f6 100644 --- a/src/SMESHUtils/SMESH_TypeDefs.hxx +++ b/src/SMESHUtils/SMESH_TypeDefs.hxx @@ -169,6 +169,7 @@ struct SMESH_TNodeXYZ : public gp_XYZ double SquareDistance(const SMDS_MeshNode* n) const { return (SMESH_TNodeXYZ( n )-*this).SquareModulus(); } bool operator==(const SMESH_TNodeXYZ& other) const { return _node == other._node; } }; +typedef SMESH_TNodeXYZ SMESH_NodeXYZ; //-------------------------------------------------- /*!