53416: SALOME crashes when selecting a sub-menu of Control menu item

This commit is contained in:
eap 2016-06-21 14:04:19 +03:00
parent 287b2ac10e
commit c18fd9d00c
7 changed files with 52 additions and 36 deletions

View File

@ -35,7 +35,7 @@ Mesh module provides several ways to create the mesh:
</li> </li>
<li>Bottom-up way, using \ref modifying_meshes_page "mesh modification" <li>Bottom-up way, using \ref modifying_meshes_page "mesh modification"
operations, especially \ref extrusion_page "extrusion" and \ref operations, especially \ref extrusion_page "extrusion" and \ref
revolution_page "revolution". To create an empty mesh not based on a revolution_page "revolution". To create an empty mesh not based on
geometry, use the same dialog as to \ref constructing_meshes_page geometry, use the same dialog as to \ref constructing_meshes_page
"construct the mesh on geometry" but specify neither the geometry "construct the mesh on geometry" but specify neither the geometry
nor meshing algorithms. nor meshing algorithms.
@ -44,9 +44,9 @@ Mesh module provides several ways to create the mesh:
(and exported to) the file in MED, UNV, STL, CGNS, DAT, GMF and (and exported to) the file in MED, UNV, STL, CGNS, DAT, GMF and
SAUVE formats. SAUVE formats.
</li> </li>
<li>The 3D mesh can be generated from the 2D mesh not based on the geometry, <li>The 3D mesh can be generated from the 2D mesh not based on geometry,
which was either \ref importing_exporting_meshes_page "imported" or created in which was either \ref importing_exporting_meshes_page "imported" or created in
other way. To setup the meshing parameters of a mesh not based on a geometry, other way. To setup the meshing parameters of a mesh not based on geometry,
just invoke \ref editing_meshes_page "Edit mesh / sub-mesh" command on just invoke \ref editing_meshes_page "Edit mesh / sub-mesh" command on
your 2D mesh. your 2D mesh.
</li> </li>

View File

@ -10,6 +10,9 @@ To create a mesh on geometry, it is necessary to create a mesh object by choosin
taken into account by the chosen meshing algorithms. taken into account by the chosen meshing algorithms.
Then you can launch mesh generation by invoking \ref compute_anchor "Compute" command. Then you can launch mesh generation by invoking \ref compute_anchor "Compute" command.
The generated mesh will be automatically shown in the Viewer. You can
switch off automatic visualization or limit mesh size until which it is
automatically shown in \ref mesh_preferences_page (<em>Automatic update</em> entry).
\note Sometimes \a hypotheses term is used to refer to both algorithms \note Sometimes \a hypotheses term is used to refer to both algorithms
and hypotheses. and hypotheses.

View File

@ -1,6 +1,6 @@
/*! /*!
\mainpage Introduction to MESH \mainpage Introduction to Mesh module
\image html a-viewgeneral.png \image html a-viewgeneral.png

View File

@ -2,8 +2,9 @@
\page max_element_length_2d_page Element Diameter 2D \page max_element_length_2d_page Element Diameter 2D
\n This quality control criterion consists in calculation of the length of \n This quality control criterion consists in calculation of the maximal length of
edges and diagonals combining 2D mesh elements (triangles and quadrangles). edges and diagonals of 2D mesh elements (triangles and quadrangles). For polygons
the value is always zero.
<em>To apply the Element Diameter 2D quality criterion to your mesh:</em> <em>To apply the Element Diameter 2D quality criterion to your mesh:</em>
<ol> <ol>

View File

@ -2,9 +2,9 @@
\page max_element_length_3d_page Element Diameter 3D \page max_element_length_3d_page Element Diameter 3D
\n This quality control criterion consists in calculation of the length of \n This quality control criterion consists in calculation of the maximal length of
edges and diagonals combining 3D mesh elements edges and diagonals of 3D mesh elements (tetrahedrons, pyramids, etc). For polyhedra
(tetrahedrons, pyramids, pentahendrons, hexahedrons and polyhedrons). the value is always zero.
<em>To apply the Element Diameter 3D quality criterion to your mesh:</em> <em>To apply the Element Diameter 3D quality criterion to your mesh:</em>
<ol> <ol>

View File

@ -265,14 +265,16 @@ namespace
filter, filter,
QObject::tr( "SMESH_IMPORT_MESH" ) ); QObject::tr( "SMESH_IMPORT_MESH" ) );
} }
if ( filenames.count() > 0 ) { if ( filenames.count() > 0 )
{
SUIT_OverrideCursor wc; SUIT_OverrideCursor wc;
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
QStringList errors; QStringList errors;
QStringList anEntryList; QStringList anEntryList;
bool isEmpty = false; bool isEmpty = false;
for ( QStringList::ConstIterator it = filenames.begin(); it != filenames.end(); ++it ) { for ( QStringList::ConstIterator it = filenames.begin(); it != filenames.end(); ++it )
{
QString filename = *it; QString filename = *it;
SMESH::mesh_array_var aMeshes = new SMESH::mesh_array; SMESH::mesh_array_var aMeshes = new SMESH::mesh_array;
try { try {
@ -365,7 +367,8 @@ namespace
arg( QObject::tr( "SMESH_ERR_UNKNOWN_IMPORT_ERROR" ) ) ); arg( QObject::tr( "SMESH_ERR_UNKNOWN_IMPORT_ERROR" ) ) );
} }
for ( int i = 0, iEnd = aMeshes->length(); i < iEnd; i++ ) { for ( int i = 0, iEnd = aMeshes->length(); i < iEnd; i++ )
{
_PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshes[i] ); _PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshes[i] );
if ( aMeshSO ) { if ( aMeshSO ) {
_PTR(StudyBuilder) aBuilder = aStudy->NewBuilder(); _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
@ -1634,11 +1637,11 @@ namespace
void Control( int theCommandID ) void Control( int theCommandID )
{ {
SMESH_Actor::eControl aControl = SMESH_Actor::eControl( ActionToControl( theCommandID ) ); SMESH_Actor::eControl aControl = SMESH_Actor::eControl( ActionToControl( theCommandID ));
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
SALOME_ListIO selected; SALOME_ListIO selected;
if ( aSel ) if ( LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr() )
aSel->selectedObjects( selected ); aSel->selectedObjects( selected );
if ( !selected.IsEmpty() ) { if ( !selected.IsEmpty() ) {
@ -1646,13 +1649,23 @@ namespace
for ( ; It.More(); It.Next()) for ( ; It.More(); It.Next())
{ {
Handle(SALOME_InteractiveObject) anIO = It.Value(); Handle(SALOME_InteractiveObject) anIO = It.Value();
if(!anIO.IsNull()){ if ( !anIO.IsNull() ) {
_PTR(SObject) SO = aStudy->FindObjectID( It.Value()->getEntry() ); _PTR(SObject) SO = aStudy->FindObjectID( It.Value()->getEntry() );
if ( SO ) { if ( SO ) {
CORBA::Object_var aObject = SMESH::SObjectToObject( SO ); CORBA::Object_var aObject = SMESH::SObjectToObject( SO );
SMESH::SMESH_IDSource_var anIDSrc = SMESH::SMESH_IDSource::_narrow( aObject ); SMESH::SMESH_IDSource_var anIDSrc = SMESH::SMESH_IDSource::_narrow( aObject );
if ( !anIDSrc->_is_nil() ) { if ( !anIDSrc->_is_nil() ) {
if ( SMESH_Actor *anActor = SMESH::FindActorByEntry( anIO->getEntry()) ) { SMESH_Actor *anActor = SMESH::FindActorByEntry( anIO->getEntry());
if (( !anActor && selected.Extent() == 1 ) &&
( anActor = SMESH::CreateActor( aStudy, anIO->getEntry() )))
{
anActor->SetControlMode( aControl );
SMESH::DisplayActor( SMESH::GetCurrentVtkView(), anActor );
SMESH::UpdateView ( SMESH::eDisplay, anIO->getEntry() );
}
if ( anActor )
{
if ( anActor->GetControlMode() != aControl )
anActor->SetControlMode( aControl ); anActor->SetControlMode( aControl );
QString functorName = functorToString( anActor->GetFunctor() ); QString functorName = functorToString( anActor->GetFunctor() );
anActor->GetScalarBarActor()->SetTitle( functorName.toLatin1().constData() ); anActor->GetScalarBarActor()->SetTitle( functorName.toLatin1().constData() );
@ -6832,17 +6845,17 @@ void SMESHGUI::onHypothesisEdit( int result )
*/ */
void SMESHGUI::onUpdateControlActions() void SMESHGUI::onUpdateControlActions()
{ {
LightApp_SelectionMgr* aSel = SMESHGUI::selectionMgr();
SALOME_ListIO selected; SALOME_ListIO selected;
if ( aSel ) if ( LightApp_SelectionMgr* aSel = SMESHGUI::selectionMgr() )
aSel->selectedObjects( selected ); aSel->selectedObjects( selected );
SMESH_Actor::eControl aControl = SMESH_Actor::eNone; SMESH_Actor::eControl aControl = SMESH_Actor::eNone;
if ( selected.Extent() ) { if ( selected.Extent() ) {
if ( selected.First()->hasEntry() ) { if ( selected.First()->hasEntry() ) {
aControl = SMESH::FindActorByEntry( selected.First()->getEntry() )->GetControlMode(); if ( SMESH_Actor* anActor = SMESH::FindActorByEntry( selected.First()->getEntry() )) {
aControl = anActor->GetControlMode();
SALOME_ListIteratorOfListIO it(selected); SALOME_ListIteratorOfListIO it(selected);
for ( ; it.More(); it.Next() ) { for ( it.Next(); it.More(); it.Next() ) {
Handle(SALOME_InteractiveObject) anIO = it.Value(); Handle(SALOME_InteractiveObject) anIO = it.Value();
if ( anIO->hasEntry() ) { if ( anIO->hasEntry() ) {
if ( SMESH_Actor* anActor = SMESH::FindActorByEntry( anIO->getEntry() ) ) { if ( SMESH_Actor* anActor = SMESH::FindActorByEntry( anIO->getEntry() ) ) {
@ -6855,6 +6868,7 @@ void SMESHGUI::onUpdateControlActions()
} }
} }
} }
}
int anAction = ActionToControl( aControl, true ); int anAction = ActionToControl( aControl, true );
if ( anAction) if ( anAction)

View File

@ -954,9 +954,7 @@ void SMESHGUI_BaseComputeOp::computeMesh()
SMESH::SMESH_GroupBase_var aGrp = aGroups[i]; SMESH::SMESH_GroupBase_var aGrp = aGroups[i];
if ( CORBA::is_nil( aGrp ) ) continue; if ( CORBA::is_nil( aGrp ) ) continue;
SMESH::SMESH_Group_var aStdGroup = SMESH::SMESH_Group::_narrow( aGrp ); SMESH::SMESH_Group_var aStdGroup = SMESH::SMESH_Group::_narrow( aGrp );
SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGrp ); if ( !aStdGroup->_is_nil() ) continue; // don't update standalone groups
SMESH::SMESH_GroupOnFilter_var aFltGroup = SMESH::SMESH_GroupOnFilter::_narrow( aGrp );
if ( !aStdGroup->_is_nil() ) continue; // don't update the standalone groups
_PTR(SObject) aGroupSO = SMESH::FindSObject( aGrp ); _PTR(SObject) aGroupSO = SMESH::FindSObject( aGrp );
if ( !aGroupSO ) continue; if ( !aGroupSO ) continue;
SMESH::SMESH_IDSource_var aGroupObj = SMESH::SMESH_IDSource_var aGroupObj =