Use GEOM_Object_var instead of GEOM_Object_wrap for obj returned by GetMainShape()

This commit is contained in:
eap 2012-12-28 11:38:13 +00:00
parent fd1f32bef8
commit 08f731ecd6
3 changed files with 7 additions and 5 deletions

View File

@ -1373,12 +1373,12 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
// The main shape of the group // The main shape of the group
GEOM::GEOM_Object_wrap aGroupMainShape; GEOM::GEOM_Object_var aGroupMainShape;
if (aGeomGroup->GetType() == 37) { if (aGeomGroup->GetType() == 37) {
GEOM::GEOM_IGroupOperations_wrap anOp = GEOM::GEOM_IGroupOperations_wrap anOp =
SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId()); SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
aGroupMainShape = anOp->GetMainShape(aGeomGroup); 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 { else {
aGroupMainShape = aGeomGroup; aGroupMainShape = aGeomGroup;

View File

@ -227,7 +227,8 @@ static SMESH::ElementType elementType(GEOM::GEOM_Object_var geom)
GEOM::GEOM_IGroupOperations_wrap aGroupOp = GEOM::GEOM_IGroupOperations_wrap aGroupOp =
SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId()); SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
if ( !aGroupOp->_is_nil() ) { if ( !aGroupOp->_is_nil() ) {
GEOM::GEOM_Object_wrap mainShape = aGroupOp->GetMainShape( 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 ); GEOM::ListOfLong_var ids = aGroupOp->GetObjects( geom );
if ( ids->length() && !mainShape->_is_nil() && !aShapeOp->_is_nil() ) { if ( ids->length() && !mainShape->_is_nil() && !aShapeOp->_is_nil() ) {
GEOM::GEOM_Object_wrap member = aShapeOp->GetSubShape( mainShape, ids[0] ); GEOM::GEOM_Object_wrap member = aShapeOp->GetSubShape( mainShape, ids[0] );

View File

@ -354,7 +354,8 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const
if (aSubGeomVar->_is_nil()) return false; if (aSubGeomVar->_is_nil()) return false;
// skl for NPAL14695 - implementation of searching of mainObj // 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) { while(1) {
if (mainObj->_is_nil()) if (mainObj->_is_nil())
return false; return false;