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
\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).

View File

@ -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})

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);
}
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,8 +97,15 @@ 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;
}
}

View File

@ -25,14 +25,12 @@
// Author : Paul RASCLE, EDF
// Module : SMESH
//
#include "SMESH_Hypothesis.hxx"
#include "SMESH_Gen.hxx"
#include "SMESHDS_Mesh.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_Hypothesis.hxx"
#include "SMESH_Mesh.hxx"
#include "SMESH_subMesh.hxx"
#include "utilities.h"
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,14 +78,14 @@ 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;
}

View File

@ -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" );

View File

@ -631,5 +631,13 @@
<source>ICON_MEASURE_BND_BOX</source>
<translation>mesh_bounding_box.png</translation>
</message>
<message>
<source>ICON_SHOW</source>
<translation>mesh_show.png</translation>
</message>
<message>
<source>ICON_HIDE</source>
<translation>mesh_hide.png</translation>
</message>
</context>
</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(); }
bool operator==(const SMESH_TNodeXYZ& other) const { return _node == other._node; }
};
typedef SMESH_TNodeXYZ SMESH_NodeXYZ;
//--------------------------------------------------
/*!