From 271ebfda771730b65e9006a6a5bb380e2abe4bf7 Mon Sep 17 00:00:00 2001 From: dmv Date: Wed, 2 Jul 2008 14:00:03 +0000 Subject: [PATCH] Bug IPAL20039 Crash when Edit Group in mesh with invalid reference (deleted object). --- src/GEOMToolsGUI/GEOMToolsGUI.cxx | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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() ) { -- 2.39.2