- some memory leaks

This commit is contained in:
eap 2009-09-10 06:02:38 +00:00
parent 38fb650b9e
commit c15f8d1936
2 changed files with 15 additions and 12 deletions

View File

@ -192,10 +192,11 @@ namespace SMESH
operator<<(CORBA::Object_ptr theArg) operator<<(CORBA::Object_ptr theArg)
{ {
SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen(); SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy(); SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy();
SALOMEDS::SObject_var aSObject = SMESH_Gen_i::ObjectToSObject(aStudy,theArg); SALOMEDS::SObject_var aSObject = SMESH_Gen_i::ObjectToSObject(aStudy,theArg);
if(!aSObject->_is_nil()) { if(!aSObject->_is_nil()) {
myStream << aSObject->GetID(); CORBA::String_var id = aSObject->GetID();
myStream << id;
} else if ( !CORBA::is_nil(theArg)) { } else if ( !CORBA::is_nil(theArg)) {
if ( aSMESHGen->CanPublishInStudy( theArg )) // not published SMESH object if ( aSMESHGen->CanPublishInStudy( theArg )) // not published SMESH object
myStream << "smeshObj_" << size_t(theArg); myStream << "smeshObj_" << size_t(theArg);

View File

@ -210,8 +210,10 @@ GEOM::GEOM_Object_ptr SMESH_Gen_i::ShapeToGeomObject (const TopoDS_Shape& theSha
GEOM_Client* aClient = GetShapeReader(); GEOM_Client* aClient = GetShapeReader();
TCollection_AsciiString IOR; TCollection_AsciiString IOR;
if ( aClient && aClient->Find( theShape, IOR )) if ( aClient && aClient->Find( theShape, IOR ))
aShapeObj = GEOM::GEOM_Object::_narrow {
( GetORB()->string_to_object( IOR.ToCString() ) ); CORBA::Object_var obj = GetORB()->string_to_object( IOR.ToCString() );
aShapeObj = GEOM::GEOM_Object::_narrow ( obj );
}
} }
return aShapeObj._retn(); return aShapeObj._retn();
} }
@ -262,7 +264,8 @@ static SALOMEDS::SObject_ptr publish(SALOMEDS::Study_ptr theStudy,
} }
if ( thePixMap ) { if ( thePixMap ) {
anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributePixMap" ); anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributePixMap" );
SALOMEDS::AttributePixMap::_narrow( anAttr )->SetPixMap( thePixMap ); SALOMEDS::AttributePixMap_var pm = SALOMEDS::AttributePixMap::_narrow( anAttr );
pm->SetPixMap( thePixMap );
} }
if ( !theSelectable ) { if ( !theSelectable ) {
anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributeSelectable" ); anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributeSelectable" );
@ -518,13 +521,12 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishMesh (SALOMEDS::Study_ptr theStudy,
// Publish global hypotheses // Publish global hypotheses
SMESH::ListOfHypothesis * hypList = theMesh->GetHypothesisList( aShapeObject ); SMESH::ListOfHypothesis_var hypList = theMesh->GetHypothesisList( aShapeObject );
if ( hypList ) for ( int i = 0; i < hypList->length(); i++ ) {
for ( int i = 0; i < hypList->length(); i++ ) { SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( hypList[ i ]);
SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( (*hypList)[ i ]); PublishHypothesis( theStudy, aHyp );
PublishHypothesis( theStudy, aHyp ); AddHypothesisToShape( theStudy, theMesh, aShapeObject, aHyp );
AddHypothesisToShape( theStudy, theMesh, aShapeObject, aHyp ); }
}
} }
// Publish submeshes // Publish submeshes