Bug IPAL20039 Crash when Edit Group in mesh with invalid reference (deleted object).

This commit is contained in:
dmv 2008-07-02 14:00:03 +00:00
parent 3d80192ae0
commit 271ebfda77

View File

@ -206,10 +206,12 @@ static bool inUse( _PTR(Study) study, const QString& component, const QMap<QStri
// collect all GEOM objects being deleted
QMap<QString, GEOM::GEOM_Object_var> gobjects;
QMap<QString, QString>::ConstIterator oit;
list<_PTR(SObject)> aSelectedSO;
for ( oit = objects.begin(); oit != objects.end(); ++oit ) {
_PTR(SObject) so = study->FindObjectID( oit.key().latin1() );
if ( !so )
continue;
aSelectedSO.push_back(so);
CORBA::Object_var corbaObj_rem = GeometryGUI::ClientSObjectToObject( so );
GEOM::GEOM_Object_var geomObj_rem = GEOM::GEOM_Object::_narrow( corbaObj_rem );
if( CORBA::is_nil( geomObj_rem ) )
@ -217,6 +219,22 @@ static bool inUse( _PTR(Study) study, const QString& component, const QMap<QStri
gobjects.insert( oit.key(), geomObj_rem );
}
// Search References with other Modules
list< _PTR(SObject) >::iterator itSO = aSelectedSO.begin();
for ( ; itSO != aSelectedSO.end(); ++itSO ) {
std::vector<_PTR(SObject)> aReferences = study->FindDependances( *itSO );
int aRefLength = aReferences.size();
if (aRefLength) {
for (int i = 0; i < aRefLength; i++) {
_PTR(SObject) firstSO( aReferences[i] );
_PTR(SComponent) aComponent = firstSO->GetFatherComponent();
QString type = aComponent->ComponentDataType();
if ( type == "SMESH" )
return true;
}
}
}
// browse through all GEOM data tree
_PTR(ChildIterator) it ( study->NewChildIterator( comp ) );
for ( it->InitEx( true ); it->More(); it->Next() ) {