From: dmv Date: Wed, 2 Jul 2008 14:00:03 +0000 (+0000) Subject: Bug IPAL20039 Crash when Edit Group in mesh with invalid reference (deleted object). X-Git-Tag: V4_1_4a1~15 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=271ebfda771730b65e9006a6a5bb380e2abe4bf7;p=modules%2Fgeom.git Bug IPAL20039 Crash when Edit Group in mesh with invalid reference (deleted object). --- diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.cxx b/src/GEOMToolsGUI/GEOMToolsGUI.cxx index d94543ad1..4718b3472 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI.cxx @@ -206,17 +206,35 @@ static bool inUse( _PTR(Study) study, const QString& component, const QMap gobjects; QMap::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 ) ) continue; 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() ) {