Fix SIGSEGV at SALOME termination after performing SALOME_TESTS/Grids/smesh/imps_05/F0

This commit is contained in:
eap 2017-03-29 14:05:00 +03:00
parent 5d0e158476
commit e2ed82ab76
9 changed files with 56 additions and 24 deletions

View File

@ -3,8 +3,8 @@
\page skew_page Skew \page skew_page Skew
\n \b Skew mesh quality criterion reflects the angle between the lines \n \b Skew mesh quality criterion reflects the angle between the lines
that join opposite sides of a quadrangle element or the greatesr angle that join opposite sides of a quadrangle element or the greatest angle
between three medians in triangle elements. This mesh quality 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 criterion can be applied to elements composed of 4 and 3 nodes
(quadrangles and triangles). (quadrangles and triangles).

View File

@ -226,6 +226,8 @@ SET(SMESH_RESOURCES_FILES
mesh_extmeth_surf_offset_smooth.png mesh_extmeth_surf_offset_smooth.png
mesh_extmeth_face_offset.png mesh_extmeth_face_offset.png
mesh_quality.png mesh_quality.png
mesh_show.png
mesh_hide.png
) )
INSTALL(FILES ${SMESH_RESOURCES_FILES} DESTINATION ${SALOME_SMESH_INSTALL_RES_DATA}) INSTALL(FILES ${SMESH_RESOURCES_FILES} DESTINATION ${SALOME_SMESH_INSTALL_RES_DATA})

BIN
resources/mesh_hide.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B

BIN
resources/mesh_show.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -73,6 +73,19 @@ SMESH_Gen::SMESH_Gen()
//vtkDebugLeaks::SetExitError(0); //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 * Destructor
@ -84,8 +97,15 @@ SMESH_Gen::~SMESH_Gen()
std::map < int, StudyContextStruct * >::iterator i_sc = _mapStudyContext.begin(); std::map < int, StudyContextStruct * >::iterator i_sc = _mapStudyContext.begin();
for ( ; i_sc != _mapStudyContext.end(); ++i_sc ) for ( ; i_sc != _mapStudyContext.end(); ++i_sc )
{ {
delete i_sc->second->myDocument; StudyContextStruct* context = i_sc->second;
delete 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;
} }
} }

View File

@ -25,14 +25,12 @@
// Author : Paul RASCLE, EDF // Author : Paul RASCLE, EDF
// Module : SMESH // Module : SMESH
// //
#include "SMESH_Hypothesis.hxx"
#include "SMESH_Gen.hxx"
#include "SMESHDS_Mesh.hxx" #include "SMESHDS_Mesh.hxx"
#include "SMESH_Gen.hxx" #include "SMESH_Hypothesis.hxx"
#include "SMESH_Mesh.hxx" #include "SMESH_Mesh.hxx"
#include "SMESH_subMesh.hxx"
#include "utilities.h"
using namespace std; using namespace std;
@ -63,8 +61,11 @@ SMESH_Hypothesis::SMESH_Hypothesis(int hypId,
SMESH_Hypothesis::~SMESH_Hypothesis() SMESH_Hypothesis::~SMESH_Hypothesis()
{ {
if ( _gen )
{
StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId); StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId);
myStudyContext->mapHypothesis[_hypId] = 0; myStudyContext->mapHypothesis[_hypId] = 0;
}
} }
//============================================================================= //=============================================================================

View File

@ -4020,8 +4020,8 @@ void SMESHGUI::initialize( CAM_Application* app )
createSMESHAction( SMESHOp::OpPropertiesArea, "MEASURE_AREA", "ICON_MEASURE_AREA" ); createSMESHAction( SMESHOp::OpPropertiesArea, "MEASURE_AREA", "ICON_MEASURE_AREA" );
createSMESHAction( SMESHOp::OpPropertiesVolume, "MEASURE_VOLUME", "ICON_MEASURE_VOLUME" ); createSMESHAction( SMESHOp::OpPropertiesVolume, "MEASURE_VOLUME", "ICON_MEASURE_VOLUME" );
createSMESHAction( SMESHOp::OpHide, "HIDE" ); createSMESHAction( SMESHOp::OpHide, "HIDE", "ICON_HIDE" );
createSMESHAction( SMESHOp::OpShow, "SHOW" ); createSMESHAction( SMESHOp::OpShow, "SHOW", "ICON_SHOW" );
createSMESHAction( SMESHOp::OpShowOnly, "DISPLAY_ONLY" ); createSMESHAction( SMESHOp::OpShowOnly, "DISPLAY_ONLY" );
createSMESHAction( SMESHOp::OpSortChild, "SORT_CHILD_ITEMS" ); createSMESHAction( SMESHOp::OpSortChild, "SORT_CHILD_ITEMS" );

View File

@ -631,5 +631,13 @@
<source>ICON_MEASURE_BND_BOX</source> <source>ICON_MEASURE_BND_BOX</source>
<translation>mesh_bounding_box.png</translation> <translation>mesh_bounding_box.png</translation>
</message> </message>
<message>
<source>ICON_SHOW</source>
<translation>mesh_show.png</translation>
</message>
<message>
<source>ICON_HIDE</source>
<translation>mesh_hide.png</translation>
</message>
</context> </context>
</TS> </TS>

View File

@ -169,6 +169,7 @@ struct SMESH_TNodeXYZ : public gp_XYZ
double SquareDistance(const SMDS_MeshNode* n) const { return (SMESH_TNodeXYZ( n )-*this).SquareModulus(); } double SquareDistance(const SMDS_MeshNode* n) const { return (SMESH_TNodeXYZ( n )-*this).SquareModulus(); }
bool operator==(const SMESH_TNodeXYZ& other) const { return _node == other._node; } bool operator==(const SMESH_TNodeXYZ& other) const { return _node == other._node; }
}; };
typedef SMESH_TNodeXYZ SMESH_NodeXYZ;
//-------------------------------------------------- //--------------------------------------------------
/*! /*!