Regression bugs_00/A3

More protection from access to a closed study
This commit is contained in:
eap 2014-04-30 18:33:20 +04:00
parent a483336704
commit fd6f0fdf57
2 changed files with 13 additions and 5 deletions

View File

@ -658,6 +658,8 @@ void SMESH_Gen_i::setCurrentStudy( SALOMEDS::Study_ptr theStudy,
SALOMEDS::Study_ptr SMESH_Gen_i::GetCurrentStudy() SALOMEDS::Study_ptr SMESH_Gen_i::GetCurrentStudy()
{ {
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::GetCurrentStudy: study Id = " << GetCurrentStudyID() ); if(MYDEBUG) MESSAGE( "SMESH_Gen_i::GetCurrentStudy: study Id = " << GetCurrentStudyID() );
if ( GetCurrentStudyID() < 0 )
return SALOMEDS::Study::_nil();
return SALOMEDS::Study::_duplicate( myCurrentStudy ); return SALOMEDS::Study::_duplicate( myCurrentStudy );
} }
@ -1052,13 +1054,18 @@ SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromMEDorSAUV( const char* theFileNa
aPythonDump << "(["; aPythonDump << "([";
if (theStatus == SMESH::DRS_OK) { if (theStatus == SMESH::DRS_OK) {
SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder(); SALOMEDS::StudyBuilder_var aStudyBuilder;
if ( GetCurrentStudyID() > -1 )
{
aStudyBuilder = myCurrentStudy->NewBuilder();
aStudyBuilder->NewCommand(); // There is a transaction aStudyBuilder->NewCommand(); // There is a transaction
}
aResult->length( aNames.size() ); aResult->length( aNames.size() );
int i = 0; int i = 0;
// Iterate through all meshes and create mesh objects // Iterate through all meshes and create mesh objects
for ( list<string>::iterator it = aNames.begin(); it != aNames.end(); it++ ) { for ( list<string>::iterator it = aNames.begin(); it != aNames.end(); it++ )
{
// Python Dump // Python Dump
if (i > 0) aPythonDump << ", "; if (i > 0) aPythonDump << ", ";
@ -1091,6 +1098,7 @@ SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromMEDorSAUV( const char* theFileNa
aResult[i++] = SMESH::SMESH_Mesh::_duplicate( mesh ); aResult[i++] = SMESH::SMESH_Mesh::_duplicate( mesh );
meshServant->GetImpl().GetMeshDS()->Modified(); meshServant->GetImpl().GetMeshDS()->Modified();
} }
if ( !aStudyBuilder->_is_nil() )
aStudyBuilder->CommitCommand(); aStudyBuilder->CommitCommand();
} }

View File

@ -160,7 +160,7 @@ long SMESH_Gen_i::GetBallElementsGroupsTag()
bool SMESH_Gen_i::CanPublishInStudy(CORBA::Object_ptr theIOR) bool SMESH_Gen_i::CanPublishInStudy(CORBA::Object_ptr theIOR)
{ {
if(MYDEBUG) MESSAGE("CanPublishInStudy - "<<!CORBA::is_nil(myCurrentStudy)); if(MYDEBUG) MESSAGE("CanPublishInStudy - "<<!CORBA::is_nil(myCurrentStudy));
if(CORBA::is_nil(myCurrentStudy)) if( GetCurrentStudyID() < 0 )
return false; return false;
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(theIOR); SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(theIOR);