0021436: EDF 1810 SMESH: Create a segment and adding it to a group causes Salome to crash

This commit is contained in:
eap 2011-11-30 14:08:25 +00:00
parent 86b8303fcf
commit e5dee33572
4 changed files with 12 additions and 8 deletions

View File

@ -243,7 +243,8 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule,
int nbNodes ) int nbNodes )
: QDialog( SMESH::GetDesktop( theModule ) ), : QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ), mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myBusy ( false )
{ {
setModal( false ); setModal( false );
setAttribute( Qt::WA_DeleteOnClose, true ); setAttribute( Qt::WA_DeleteOnClose, true );
@ -371,6 +372,7 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule,
TextLabel_GroupName = new QLabel( tr( "SMESH_GROUP" ), GroupGroups ); TextLabel_GroupName = new QLabel( tr( "SMESH_GROUP" ), GroupGroups );
ComboBox_GroupName = new QComboBox( GroupGroups ); ComboBox_GroupName = new QComboBox( GroupGroups );
ComboBox_GroupName->setEditable( true ); ComboBox_GroupName->setEditable( true );
ComboBox_GroupName->setInsertPolicy( QComboBox::NoInsert );
GroupGroupsLayout->addWidget( TextLabel_GroupName ); GroupGroupsLayout->addWidget( TextLabel_GroupName );
GroupGroupsLayout->addWidget( ComboBox_GroupName, 1 ); GroupGroupsLayout->addWidget( ComboBox_GroupName, 1 );
@ -496,7 +498,7 @@ void SMESHGUI_AddMeshElementDlg::ClickOnApply()
if ( aGroupName == aName && ( i == ComboBox_GroupName->currentIndex() || idx == 0 ) ) if ( aGroupName == aName && ( i == ComboBox_GroupName->currentIndex() || idx == 0 ) )
idx = i; idx = i;
} }
if ( idx > 0 ) { if ( idx > 0 && idx < myGroups.count() ) {
SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( myGroups[idx-1] ); SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( myGroups[idx-1] );
if ( !aGeomGroup->_is_nil() ) { if ( !aGeomGroup->_is_nil() ) {
int res = SUIT_MessageBox::question( this, tr( "SMESH_WRN_WARNING" ), int res = SUIT_MessageBox::question( this, tr( "SMESH_WRN_WARNING" ),

View File

@ -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 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}; static int LastHexahedronIds[] = {1,2,3,0,5,6,7,4,4,5,6,7};
/*! /*!
\class BusyLocker \class BusyLocker
\brief Simple 'busy state' flag locker. \brief Simple 'busy state' flag locker.
@ -419,7 +417,8 @@ SMESHGUI_AddQuadraticElementDlg::SMESHGUI_AddQuadraticElementDlg( SMESHGUI* theM
mySMESHGUI( theModule ), mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myType( theType ), myType( theType ),
myBusy( false ) myBusy( false ),
myIsEditCorners( false )
{ {
setModal( false ); setModal( false );
setAttribute( Qt::WA_DeleteOnClose, true ); setAttribute( Qt::WA_DeleteOnClose, true );
@ -518,6 +517,7 @@ SMESHGUI_AddQuadraticElementDlg::SMESHGUI_AddQuadraticElementDlg( SMESHGUI* theM
TextLabel_GroupName = new QLabel( tr( "SMESH_GROUP" ), GroupGroups ); TextLabel_GroupName = new QLabel( tr( "SMESH_GROUP" ), GroupGroups );
ComboBox_GroupName = new QComboBox( GroupGroups ); ComboBox_GroupName = new QComboBox( GroupGroups );
ComboBox_GroupName->setEditable( true ); ComboBox_GroupName->setEditable( true );
ComboBox_GroupName->setInsertPolicy( QComboBox::NoInsert );
GroupGroupsLayout->addWidget( TextLabel_GroupName ); GroupGroupsLayout->addWidget( TextLabel_GroupName );
GroupGroupsLayout->addWidget( ComboBox_GroupName, 1 ); GroupGroupsLayout->addWidget( ComboBox_GroupName, 1 );
@ -733,7 +733,7 @@ void SMESHGUI_AddQuadraticElementDlg::ClickOnApply()
if ( aGroupName == aName && ( i == ComboBox_GroupName->currentIndex() || idx == 0 ) ) if ( aGroupName == aName && ( i == ComboBox_GroupName->currentIndex() || idx == 0 ) )
idx = i; idx = i;
} }
if ( idx > 0 ) { if ( idx > 0 && idx < myGroups.count() ) {
SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( myGroups[idx-1] ); SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( myGroups[idx-1] );
if ( !aGeomGroup->_is_nil() ) { if ( !aGeomGroup->_is_nil() ) {
int res = SUIT_MessageBox::question( this, tr( "SMESH_WRN_WARNING" ), int res = SUIT_MessageBox::question( this, tr( "SMESH_WRN_WARNING" ),

View File

@ -259,6 +259,7 @@ SMESHGUI_CreatePolyhedralVolumeDlg::SMESHGUI_CreatePolyhedralVolumeDlg( SMESHGUI
TextLabel_GroupName = new QLabel( tr( "SMESH_GROUP" ), GroupGroups ); TextLabel_GroupName = new QLabel( tr( "SMESH_GROUP" ), GroupGroups );
ComboBox_GroupName = new QComboBox( GroupGroups ); ComboBox_GroupName = new QComboBox( GroupGroups );
ComboBox_GroupName->setEditable( true ); ComboBox_GroupName->setEditable( true );
ComboBox_GroupName->setInsertPolicy( QComboBox::NoInsert );
GroupGroupsLayout->addWidget( TextLabel_GroupName ); GroupGroupsLayout->addWidget( TextLabel_GroupName );
GroupGroupsLayout->addWidget( ComboBox_GroupName, 1 ); GroupGroupsLayout->addWidget( ComboBox_GroupName, 1 );
@ -462,7 +463,7 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnApply()
if ( aGroupName == aName && ( i == ComboBox_GroupName->currentIndex() || idx == 0 ) ) if ( aGroupName == aName && ( i == ComboBox_GroupName->currentIndex() || idx == 0 ) )
idx = i; idx = i;
} }
if ( idx > 0 ) { if ( idx > 0 && idx < myGroups.count() ) {
SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( myGroups[idx-1] ); SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( myGroups[idx-1] );
if ( !aGeomGroup->_is_nil() ) { if ( !aGeomGroup->_is_nil() ) {
int res = SUIT_MessageBox::question( this, tr( "SMESH_WRN_WARNING" ), int res = SUIT_MessageBox::question( this, tr( "SMESH_WRN_WARNING" ),

View File

@ -297,6 +297,7 @@ SMESHGUI_NodesDlg::SMESHGUI_NodesDlg( SMESHGUI* theModule ):
TextLabel_GroupName = new QLabel( tr( "SMESH_GROUP" ), GroupGroups ); TextLabel_GroupName = new QLabel( tr( "SMESH_GROUP" ), GroupGroups );
ComboBox_GroupName = new QComboBox( GroupGroups ); ComboBox_GroupName = new QComboBox( GroupGroups );
ComboBox_GroupName->setEditable( true ); ComboBox_GroupName->setEditable( true );
ComboBox_GroupName->setInsertPolicy( QComboBox::NoInsert );
GroupGroupsLayout->addWidget( TextLabel_GroupName ); GroupGroupsLayout->addWidget( TextLabel_GroupName );
GroupGroupsLayout->addWidget( ComboBox_GroupName, 1 ); GroupGroupsLayout->addWidget( ComboBox_GroupName, 1 );
@ -456,7 +457,7 @@ bool SMESHGUI_NodesDlg::ClickOnApply()
if ( aGroupName == aName && ( i == ComboBox_GroupName->currentIndex() || idx == 0 ) ) if ( aGroupName == aName && ( i == ComboBox_GroupName->currentIndex() || idx == 0 ) )
idx = i; idx = i;
} }
if ( idx > 0 ) { if ( idx > 0 && idx < myGroups.count() ) {
SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( myGroups[idx-1] ); SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( myGroups[idx-1] );
if ( !aGeomGroup->_is_nil() ) { if ( !aGeomGroup->_is_nil() ) {
int res = SUIT_MessageBox::question( this, tr( "SMESH_WRN_WARNING" ), int res = SUIT_MessageBox::question( this, tr( "SMESH_WRN_WARNING" ),