From: eap Date: Wed, 23 Nov 2011 15:44:41 +0000 (+0000) Subject: 0021403: EDF 1972 VISU: Crash when dumping study X-Git-Tag: V6_4_0~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=484302c873dc5d5983ff9ac9e7a3d06c024acf7c;p=modules%2Fvisu.git 0021403: EDF 1972 VISU: Crash when dumping study Remove a ColoredPrs3dHolder if a Result it refers to is removed --- diff --git a/src/VISU_I/VISU_Result_i.cc b/src/VISU_I/VISU_Result_i.cc index a49ff289..e3058e7a 100644 --- a/src/VISU_I/VISU_Result_i.cc +++ b/src/VISU_I/VISU_Result_i.cc @@ -141,6 +141,31 @@ namespace VISU aStudyBuilder->Addreference(newObj,aRefSObj); } + //--------------------------------------------------------------- + // Issue 0021403. Remove a ColoredPrs3dHolder if a Result it refers to is removed + // + void RemoveHolders(VISU::Result_i* theResult) + { + CORBA::String_var resultID1 = theResult->GetID(); + SALOMEDS::SObject_var theResSObject = theResult->GetSObject(); + SALOMEDS::Study_var aStudyDocument = theResSObject->GetStudy(); + SALOMEDS::SComponent_var aCompSObj = theResSObject->GetFatherComponent(); + SALOMEDS::ChildIterator_var aChildIter = aStudyDocument->NewChildIterator(aCompSObj); + for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) + { + SALOMEDS::SObject_var aChildSObject = aChildIter->Value(); + if ( CORBA::is_nil( aChildSObject )) continue; + CORBA::Object_var aChildObj = aChildSObject->GetObject(); + if ( CORBA::is_nil( aChildObj )) continue; + VISU::ColoredPrs3dHolder_var prsHolder = ColoredPrs3dHolder::_narrow( aChildObj ); + if ( prsHolder->_is_nil() ) continue; + // check if the prsHolder refers to theResult + VISU::ColoredPrs3dHolder::BasicInput_var input = prsHolder->GetBasicInput(); + CORBA::String_var resultID2 = input->myResult->GetID(); + if ( strcmp( resultID1, resultID2 ) == 0 ) + prsHolder->RemoveFromStudy(); + } + } //--------------------------------------------------------------- } @@ -220,6 +245,7 @@ VISU::Result_i void Execute() { + RemoveHolders(myRemovable); VISU::RemoveFromStudy(myRemovable->GetSObject(),false); myRemovable->UnRegister(); }