From e5dee335729a15bd0c3009a466df3dc8c6224981 Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 30 Nov 2011 14:08:25 +0000 Subject: [PATCH 1/1] 0021436: EDF 1810 SMESH: Create a segment and adding it to a group causes Salome to crash --- src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx | 6 ++++-- src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx | 8 ++++---- src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx | 3 ++- src/SMESHGUI/SMESHGUI_NodesDlg.cxx | 3 ++- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx index 6e25fd08f..0de69046a 100644 --- a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx @@ -243,7 +243,8 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule, int nbNodes ) : QDialog( SMESH::GetDesktop( theModule ) ), mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), + myBusy ( false ) { setModal( false ); setAttribute( Qt::WA_DeleteOnClose, true ); @@ -371,6 +372,7 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule, TextLabel_GroupName = new QLabel( tr( "SMESH_GROUP" ), GroupGroups ); ComboBox_GroupName = new QComboBox( GroupGroups ); ComboBox_GroupName->setEditable( true ); + ComboBox_GroupName->setInsertPolicy( QComboBox::NoInsert ); GroupGroupsLayout->addWidget( TextLabel_GroupName ); GroupGroupsLayout->addWidget( ComboBox_GroupName, 1 ); @@ -496,7 +498,7 @@ void SMESHGUI_AddMeshElementDlg::ClickOnApply() if ( aGroupName == aName && ( i == ComboBox_GroupName->currentIndex() || idx == 0 ) ) idx = i; } - if ( idx > 0 ) { + if ( idx > 0 && idx < myGroups.count() ) { SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( myGroups[idx-1] ); if ( !aGeomGroup->_is_nil() ) { int res = SUIT_MessageBox::question( this, tr( "SMESH_WRN_WARNING" ), diff --git a/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx b/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx index daa119db5..4f7459785 100644 --- a/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx @@ -359,8 +359,6 @@ static int LastPentahedronIds[] = {1,2,0,4,5,3,3,4,5}; static int FirstHexahedronIds[] = {0,1,2,3,4,5,6,7,0,1,2,3}; static int LastHexahedronIds[] = {1,2,3,0,5,6,7,4,4,5,6,7}; - - /*! \class BusyLocker \brief Simple 'busy state' flag locker. @@ -419,7 +417,8 @@ SMESHGUI_AddQuadraticElementDlg::SMESHGUI_AddQuadraticElementDlg( SMESHGUI* theM mySMESHGUI( theModule ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), myType( theType ), - myBusy( false ) + myBusy( false ), + myIsEditCorners( false ) { setModal( false ); setAttribute( Qt::WA_DeleteOnClose, true ); @@ -518,6 +517,7 @@ SMESHGUI_AddQuadraticElementDlg::SMESHGUI_AddQuadraticElementDlg( SMESHGUI* theM TextLabel_GroupName = new QLabel( tr( "SMESH_GROUP" ), GroupGroups ); ComboBox_GroupName = new QComboBox( GroupGroups ); ComboBox_GroupName->setEditable( true ); + ComboBox_GroupName->setInsertPolicy( QComboBox::NoInsert ); GroupGroupsLayout->addWidget( TextLabel_GroupName ); GroupGroupsLayout->addWidget( ComboBox_GroupName, 1 ); @@ -733,7 +733,7 @@ void SMESHGUI_AddQuadraticElementDlg::ClickOnApply() if ( aGroupName == aName && ( i == ComboBox_GroupName->currentIndex() || idx == 0 ) ) idx = i; } - if ( idx > 0 ) { + if ( idx > 0 && idx < myGroups.count() ) { SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( myGroups[idx-1] ); if ( !aGeomGroup->_is_nil() ) { int res = SUIT_MessageBox::question( this, tr( "SMESH_WRN_WARNING" ), diff --git a/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx b/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx index aef376bc9..835d24066 100644 --- a/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx @@ -259,6 +259,7 @@ SMESHGUI_CreatePolyhedralVolumeDlg::SMESHGUI_CreatePolyhedralVolumeDlg( SMESHGUI TextLabel_GroupName = new QLabel( tr( "SMESH_GROUP" ), GroupGroups ); ComboBox_GroupName = new QComboBox( GroupGroups ); ComboBox_GroupName->setEditable( true ); + ComboBox_GroupName->setInsertPolicy( QComboBox::NoInsert ); GroupGroupsLayout->addWidget( TextLabel_GroupName ); GroupGroupsLayout->addWidget( ComboBox_GroupName, 1 ); @@ -462,7 +463,7 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnApply() if ( aGroupName == aName && ( i == ComboBox_GroupName->currentIndex() || idx == 0 ) ) idx = i; } - if ( idx > 0 ) { + if ( idx > 0 && idx < myGroups.count() ) { SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( myGroups[idx-1] ); if ( !aGeomGroup->_is_nil() ) { int res = SUIT_MessageBox::question( this, tr( "SMESH_WRN_WARNING" ), diff --git a/src/SMESHGUI/SMESHGUI_NodesDlg.cxx b/src/SMESHGUI/SMESHGUI_NodesDlg.cxx index 460e532d3..286d0012e 100644 --- a/src/SMESHGUI/SMESHGUI_NodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_NodesDlg.cxx @@ -297,6 +297,7 @@ SMESHGUI_NodesDlg::SMESHGUI_NodesDlg( SMESHGUI* theModule ): TextLabel_GroupName = new QLabel( tr( "SMESH_GROUP" ), GroupGroups ); ComboBox_GroupName = new QComboBox( GroupGroups ); ComboBox_GroupName->setEditable( true ); + ComboBox_GroupName->setInsertPolicy( QComboBox::NoInsert ); GroupGroupsLayout->addWidget( TextLabel_GroupName ); GroupGroupsLayout->addWidget( ComboBox_GroupName, 1 ); @@ -456,7 +457,7 @@ bool SMESHGUI_NodesDlg::ClickOnApply() if ( aGroupName == aName && ( i == ComboBox_GroupName->currentIndex() || idx == 0 ) ) idx = i; } - if ( idx > 0 ) { + if ( idx > 0 && idx < myGroups.count() ) { SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( myGroups[idx-1] ); if ( !aGeomGroup->_is_nil() ) { int res = SUIT_MessageBox::question( this, tr( "SMESH_WRN_WARNING" ), -- 2.30.2