Salome HOME
PAL16774 (Crash after display of many groups)
[modules/smesh.git] / src / SMESH_I / SMESH_Gen_i_1.cxx
index 2021f22e2df7a4c43c62934b4ee3757577eb3a6e..d179f62d1ded9d7011f3e51f55d767f3bd7acd98 100644 (file)
@@ -32,6 +32,7 @@
 #include "SMESH_Hypothesis_i.hxx"
 #include "SMESH_Algo_i.hxx"
 #include "SMESH_Group_i.hxx"
+#include "SMESH_subMesh_i.hxx"
 
 #include "SMESH.hxx"
 
@@ -180,7 +181,10 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::ObjectToSObject(SALOMEDS::Study_ptr theStudy,
 {
   SALOMEDS::SObject_var aSO;
   if ( !CORBA::is_nil( theStudy ) && !CORBA::is_nil( theObject ))
-    aSO = theStudy->FindObjectIOR( SMESH_Gen_i::GetORB()->object_to_string( theObject ) );
+  {
+    CORBA::String_var objStr = SMESH_Gen_i::GetORB()->object_to_string( theObject );
+    aSO = theStudy->FindObjectIOR( objStr.in() );
+  }
   return aSO._retn();
 }
 
@@ -222,7 +226,7 @@ TopoDS_Shape SMESH_Gen_i::GeomObjectToShape(GEOM::GEOM_Object_ptr theGeomObject)
   TopoDS_Shape S;
   if ( !theGeomObject->_is_nil() ) {
     GEOM_Client* aClient = GetShapeReader();
-    GEOM::GEOM_Gen_var aGeomEngine = GetGeomEngine();
+    GEOM::GEOM_Gen_ptr aGeomEngine = GetGeomEngine();
     if ( aClient && !aGeomEngine->_is_nil () )
       S = aClient->GetShape( aGeomEngine, theGeomObject );
   }
@@ -253,8 +257,8 @@ static SALOMEDS::SObject_ptr publish(SALOMEDS::Study_ptr   theStudy,
   SALOMEDS::GenericAttribute_var anAttr;
   if ( !CORBA::is_nil( theIOR )) {
     anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributeIOR" );
-    SALOMEDS::AttributeIOR::_narrow(anAttr)->SetValue
-      ( SMESH_Gen_i::GetORB()->object_to_string( theIOR ) );
+    CORBA::String_var objStr = SMESH_Gen_i::GetORB()->object_to_string( theIOR );
+    SALOMEDS::AttributeIOR::_narrow(anAttr)->SetValue( objStr.in() );
   }
   if ( thePixMap ) {
     anAttr  = aStudyBuilder->FindOrCreateAttribute( SO, "AttributePixMap" );