Salome HOME
Use GEOM_Object_var instead of GEOM_Object_wrap for obj returned by GetMainShape()
authoreap <eap@opencascade.com>
Fri, 28 Dec 2012 11:38:13 +0000 (11:38 +0000)
committereap <eap@opencascade.com>
Fri, 28 Dec 2012 11:38:13 +0000 (11:38 +0000)
src/SMESHGUI/SMESHGUI_GroupDlg.cxx
src/SMESHGUI/SMESHGUI_GroupOnShapeDlg.cxx
src/SMESHGUI/SMESHGUI_MeshOp.cxx

index e7eccaee797910a8d49ca18c0e5b8208b058075c..03ebc273151c28875f28c9e3f5530e38c877ec56 100644 (file)
@@ -1373,12 +1373,12 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
         _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
 
         // The main shape of the group
-        GEOM::GEOM_Object_wrap aGroupMainShape;
+        GEOM::GEOM_Object_var aGroupMainShape;
         if (aGeomGroup->GetType() == 37) {
           GEOM::GEOM_IGroupOperations_wrap anOp =
             SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
           aGroupMainShape = anOp->GetMainShape(aGeomGroup);
-          // aGroupMainShape is a new geom servant to be deleted by GEOM_Object_wrap
+          // aGroupMainShape is an existing servant => GEOM_Object_var not GEOM_Object_wrap
         }
         else {
           aGroupMainShape = aGeomGroup;
index 2b797a4219605c4cb8355cc8135ec076cd60efb6..e93d148e8c7d5a2948e00f81f5ef4116f0d68184 100644 (file)
@@ -227,8 +227,9 @@ static SMESH::ElementType elementType(GEOM::GEOM_Object_var geom)
       GEOM::GEOM_IGroupOperations_wrap aGroupOp =
         SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
       if ( !aGroupOp->_is_nil() ) {
-        GEOM::GEOM_Object_wrap mainShape = aGroupOp->GetMainShape( geom );
-        GEOM::ListOfLong_var         ids = aGroupOp->GetObjects( geom );
+        // mainShape is an existing servant => GEOM_Object_var not GEOM_Object_wrap
+        GEOM::GEOM_Object_var mainShape = aGroupOp->GetMainShape( geom );
+        GEOM::ListOfLong_var        ids = aGroupOp->GetObjects( geom );
         if ( ids->length() && !mainShape->_is_nil() && !aShapeOp->_is_nil() ) {
           GEOM::GEOM_Object_wrap member = aShapeOp->GetSubShape( mainShape, ids[0] );
           return elementType( member );
index 00ad90ec527c2624d1397af5815eb091de4c41bf..9d9aa1c0ccc2c9516e4e7ab4b0551bc3062ebffb 100644 (file)
@@ -354,7 +354,8 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const
       if (aSubGeomVar->_is_nil()) return false;
 
       // skl for NPAL14695 - implementation of searching of mainObj
-      GEOM::GEOM_Object_wrap mainObj = op->GetMainShape(aSubGeomVar);
+      GEOM::GEOM_Object_var mainObj = op->GetMainShape(aSubGeomVar); /* _var not _wrap as
+                                                                        mainObj already exists! */
       while(1) {
         if (mainObj->_is_nil())
           return false;