#16578 EDF - Scibian - ViscousLayer / SIGSEGV

This commit is contained in:
eap 2019-02-14 14:22:06 +03:00
parent 1aaacad698
commit 27c94e830e
3 changed files with 25 additions and 11 deletions

View File

@ -263,6 +263,10 @@ SMESH_Algo::GetUsedHypothesis(SMESH_Mesh & aMesh,
const bool ignoreAuxiliary) const const bool ignoreAuxiliary) const
{ {
SMESH_Algo* me = const_cast< SMESH_Algo* >( this ); SMESH_Algo* me = const_cast< SMESH_Algo* >( this );
std::list<const SMESHDS_Hypothesis *> savedHyps; // don't delete the list if
savedHyps.swap( me->_usedHypList ); // it does not change (#16578)
me->_usedHypList.clear(); me->_usedHypList.clear();
if ( const SMESH_HypoFilter* filter = GetCompatibleHypoFilter( ignoreAuxiliary )) if ( const SMESH_HypoFilter* filter = GetCompatibleHypoFilter( ignoreAuxiliary ))
{ {
@ -270,6 +274,9 @@ SMESH_Algo::GetUsedHypothesis(SMESH_Mesh & aMesh,
if ( ignoreAuxiliary && _usedHypList.size() > 1 ) if ( ignoreAuxiliary && _usedHypList.size() > 1 )
me->_usedHypList.clear(); //only one compatible hypothesis allowed me->_usedHypList.clear(); //only one compatible hypothesis allowed
} }
if ( _usedHypList == savedHyps )
savedHyps.swap( me->_usedHypList );
return _usedHypList; return _usedHypList;
} }
@ -287,10 +294,17 @@ SMESH_Algo::GetAppliedHypothesis(SMESH_Mesh & aMesh,
const bool ignoreAuxiliary) const const bool ignoreAuxiliary) const
{ {
SMESH_Algo* me = const_cast< SMESH_Algo* >( this ); SMESH_Algo* me = const_cast< SMESH_Algo* >( this );
std::list<const SMESHDS_Hypothesis *> savedHyps; // don't delete the list if
savedHyps.swap( me->_appliedHypList ); // it does not change (#16578)
me->_appliedHypList.clear(); me->_appliedHypList.clear();
if ( const SMESH_HypoFilter* filter = GetCompatibleHypoFilter( ignoreAuxiliary )) if ( const SMESH_HypoFilter* filter = GetCompatibleHypoFilter( ignoreAuxiliary ))
aMesh.GetHypotheses( aShape, *filter, me->_appliedHypList, false ); aMesh.GetHypotheses( aShape, *filter, me->_appliedHypList, false );
if ( _appliedHypList == savedHyps )
savedHyps.swap( me->_appliedHypList );
return _appliedHypList; return _appliedHypList;
} }

View File

@ -7394,16 +7394,16 @@ void SMESH_MeshEditor_i::MakePolyLine(SMESH::ListOfPolySegments& theSegments,
} }
else if ( theGroupName[0] ) // find/create a group of segments else if ( theGroupName[0] ) // find/create a group of segments
{ {
SMESH_Mesh::GroupIteratorPtr grpIt = myMesh->GetGroups(); // SMESH_Mesh::GroupIteratorPtr grpIt = myMesh->GetGroups();
while ( !groupDS && grpIt->more() ) // while ( !groupDS && grpIt->more() )
{ // {
SMESH_Group* group = grpIt->next(); // SMESH_Group* group = grpIt->next();
if ( group->GetGroupDS()->GetType() == SMDSAbs_Edge && // if ( group->GetGroupDS()->GetType() == SMDSAbs_Edge &&
strcmp( group->GetName(), theGroupName ) == 0 ) // strcmp( group->GetName(), theGroupName ) == 0 )
{ // {
groupDS = dynamic_cast< SMESHDS_Group* >( group->GetGroupDS() ); // groupDS = dynamic_cast< SMESHDS_Group* >( group->GetGroupDS() );
} // }
} // }
if ( !groupDS ) if ( !groupDS )
{ {
SMESH::SMESH_Group_var groupVar = myMesh_i->CreateGroup( SMESH::EDGE, theGroupName ); SMESH::SMESH_Group_var groupVar = myMesh_i->CreateGroup( SMESH::EDGE, theGroupName );

View File

@ -5356,7 +5356,7 @@ void SMESH_Mesh_i::CreateGroupServants()
while ( groupIt->more() ) while ( groupIt->more() )
{ {
::SMESH_Group* group = groupIt->next(); ::SMESH_Group* group = groupIt->next();
int anId = group->GetGroupDS()->GetID(); int anId = group->GetID();
map<int, SMESH::SMESH_GroupBase_ptr>::iterator it = _mapGroups.find(anId); map<int, SMESH::SMESH_GroupBase_ptr>::iterator it = _mapGroups.find(anId);
if ( it != _mapGroups.end() && !CORBA::is_nil( it->second )) if ( it != _mapGroups.end() && !CORBA::is_nil( it->second ))