From 74d40c014d6d588a05f0e01da31653472273b135 Mon Sep 17 00:00:00 2001 From: eap Date: Mon, 22 Jul 2013 14:40:00 +0000 Subject: [PATCH] SALOME Forum bug: sub-mesh removal leads to an Exception in a re-opened study. Now UnRegister(), corresponding to the Register() called by AttributeIOR, is invoked by an object publisher i.e. by SMESH_Gen_i::publish() but not by GUI because GUI is unable to track publication of all objects created by the Engine: for example groups can be created while mesh.Compute() is called. --- src/SMESH_I/SMESH_Gen_i_1.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/SMESH_I/SMESH_Gen_i_1.cxx b/src/SMESH_I/SMESH_Gen_i_1.cxx index fc50bc409..562750c6c 100644 --- a/src/SMESH_I/SMESH_Gen_i_1.cxx +++ b/src/SMESH_I/SMESH_Gen_i_1.cxx @@ -260,7 +260,7 @@ static SALOMEDS::SObject_ptr publish(SALOMEDS::Study_ptr theStudy, const bool theSelectable = true) { SALOMEDS::SObject_wrap SO = SMESH_Gen_i::ObjectToSObject( theStudy, theIOR ); - SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder(); + SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder(); SALOMEDS::UseCaseBuilder_var useCaseBuilder = theStudy->GetUseCaseBuilder(); if ( SO->_is_nil() ) { if ( theTag == 0 ) @@ -275,6 +275,10 @@ static SALOMEDS::SObject_ptr publish(SALOMEDS::Study_ptr theStudy, CORBA::String_var objStr = SMESH_Gen_i::GetORB()->object_to_string( theIOR ); SALOMEDS::AttributeIOR_wrap iorAttr = anAttr; iorAttr->SetValue( objStr.in() ); + // UnRegister() !!! + SALOME::GenericObj_var genObj = SALOME::GenericObj::_narrow( theIOR ); + if ( !genObj->_is_nil() ) + genObj->UnRegister(); } if ( thePixMap ) { anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributePixMap" ); @@ -1179,7 +1183,7 @@ char* SMESH_Gen_i::GetParameters(CORBA::Object_ptr theObject) { CORBA::String_var aResult(""); - SALOMEDS::SObject_wrap aSObj = ObjectToSObject( myCurrentStudy,theObject); + SALOMEDS::SObject_wrap aSObj = ObjectToSObject( myCurrentStudy, theObject ); if ( !aSObj->_is_nil() ) { SALOMEDS::GenericAttribute_wrap attr; @@ -1189,6 +1193,5 @@ char* SMESH_Gen_i::GetParameters(CORBA::Object_ptr theObject) aResult = strAttr->Value(); } } - - return CORBA::string_dup( aResult.in() ); + return aResult._retn(); } -- 2.39.2