Fix crash after 'Belong to' filter creation if there are no mesh in the study

This commit is contained in:
jfa 2005-10-04 07:35:48 +00:00
parent 694e1d2360
commit 8ad9cef463
2 changed files with 100 additions and 98 deletions

View File

@ -1059,6 +1059,10 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
if( !mgr ) if( !mgr )
return false; return false;
if (CORBA::is_nil(GetSMESHGen()->GetCurrentStudy())) {
GetSMESHGen()->SetCurrentStudy(_CAST(Study,aStudy)->GetStudy());
}
SUIT_ViewWindow* view = application()->desktop()->activeWindow(); SUIT_ViewWindow* view = application()->desktop()->activeWindow();
SVTK_ViewWindow* vtkwnd = dynamic_cast<SVTK_ViewWindow*>( view ); SVTK_ViewWindow* vtkwnd = dynamic_cast<SVTK_ViewWindow*>( view );
@ -2754,8 +2758,8 @@ void SMESHGUI::initialize( CAM_Application* app )
QString anActiveVTK = QString("activeView = '%1'").arg(VTKViewer_Viewer::Type()); QString anActiveVTK = QString("activeView = '%1'").arg(VTKViewer_Viewer::Type());
QString aSelCount = QString( "%1 > 0" ).arg( QtxPopupMgr::Selection::defSelCountParam() ); QString aSelCount = QString( "%1 > 0" ).arg( QtxPopupMgr::Selection::defSelCountParam() );
QString aRule = "$component={'SMESH'} and ( type='Component' or (" + aClient + " and " + aType + " and " + aSelCount + QString aRule = "$component={'SMESH'} and ( type='Component' or (" + aClient + " and " +
" and " + anActiveVTK + " and " + isNotEmpty + " %1 ) )"; aType + " and " + aSelCount + " and " + anActiveVTK + " and " + isNotEmpty + " %1 ) )";
popupMgr()->insert( action( 301 ), -1, -1 ); // DISPLAY popupMgr()->insert( action( 301 ), -1, -1 ); // DISPLAY
popupMgr()->setRule( action( 301 ), aRule.arg( "and (not isVisible)" ), true); popupMgr()->setRule( action( 301 ), aRule.arg( "and (not isVisible)" ), true);

View File

@ -376,7 +376,7 @@ static TopoDS_Shape getShapeByName( const char* theName )
{ {
SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen(); SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy(); SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy();
if ( aStudy != 0 ) if (!CORBA::is_nil(aStudy))
{ {
SALOMEDS::Study::ListOfSObject_var aList = SALOMEDS::Study::ListOfSObject_var aList =
aStudy->FindObjectByName( theName, "GEOM" ); aStudy->FindObjectByName( theName, "GEOM" );
@ -614,7 +614,6 @@ SMESH::Length2D::Values* Length2D_i::GetValues()
aValue.myLength = aVal.myLength; aValue.myLength = aVal.myLength;
aValue.myPnt1 = aVal.myPntId[ 0 ]; aValue.myPnt1 = aVal.myPntId[ 0 ];
aValue.myPnt2 = aVal.myPntId[ 1 ]; aValue.myPnt2 = aVal.myPntId[ 1 ];
} }
INFOS("Length2D_i::GetValuess~"); INFOS("Length2D_i::GetValuess~");
@ -670,7 +669,6 @@ SMESH::MultiConnection2D::Values* MultiConnection2D_i::GetValues()
aValue.myPnt1 = aVal.myPntId[ 0 ]; aValue.myPnt1 = aVal.myPntId[ 0 ];
aValue.myPnt2 = aVal.myPntId[ 1 ]; aValue.myPnt2 = aVal.myPntId[ 1 ];
aValue.myNbConnects = (*anIter).second; aValue.myNbConnects = (*anIter).second;
} }
INFOS("Multiconnection2D_i::GetValuess~"); INFOS("Multiconnection2D_i::GetValuess~");