22594: [CEA 1159] Salome crashes when loading a dumped meshing script

Avoid destruction on myHyp when it is unpublished
This commit is contained in:
eap 2014-05-21 14:30:17 +04:00
parent 3d496b2c57
commit a453a47bea

View File

@ -67,6 +67,8 @@ StdMeshers_LayerDistribution_i::StdMeshers_LayerDistribution_i( PortableServer::
StdMeshers_LayerDistribution_i::~StdMeshers_LayerDistribution_i() StdMeshers_LayerDistribution_i::~StdMeshers_LayerDistribution_i()
{ {
MESSAGE( "StdMeshers_LayerDistribution_i::~StdMeshers_LayerDistribution_i" ); MESSAGE( "StdMeshers_LayerDistribution_i::~StdMeshers_LayerDistribution_i" );
if ( !myHyp->_is_nil() )
myHyp->UnRegister();
} }
//============================================================================= //=============================================================================
@ -86,6 +88,7 @@ void StdMeshers_LayerDistribution_i::SetLayerDistribution(SMESH::SMESH_Hypothesi
bool isNewHyp = ( hyp_i->GetImpl() != this->GetImpl()->GetLayerDistribution() ); bool isNewHyp = ( hyp_i->GetImpl() != this->GetImpl()->GetLayerDistribution() );
this->GetImpl()->SetLayerDistribution( hyp_i->GetImpl() ); this->GetImpl()->SetLayerDistribution( hyp_i->GetImpl() );
myHyp = SMESH::SMESH_Hypothesis::_duplicate( hyp1D ); myHyp = SMESH::SMESH_Hypothesis::_duplicate( hyp1D );
myHyp->Register();
// Remove SO of 1D hypothesis if it was published // Remove SO of 1D hypothesis if it was published
if (SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen()) if (SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen())
{ {
@ -148,6 +151,7 @@ SMESH::SMESH_Hypothesis_ptr StdMeshers_LayerDistribution_i::GetLayerDistribution
* Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration) * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
*/ */
//================================================================================ //================================================================================
CORBA::Boolean StdMeshers_LayerDistribution_i::IsDimSupported( SMESH::Dimension type ) CORBA::Boolean StdMeshers_LayerDistribution_i::IsDimSupported( SMESH::Dimension type )
{ {
return type == SMESH::DIM_3D; return type == SMESH::DIM_3D;