From 9beb8d27644a2b0e2585bea7f990457a3d80d643 Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 15 Jun 2020 18:44:50 +0300 Subject: [PATCH] bos #19219 [CEA] SIGSEGV when right-click in the view in 3D layers dialog box --- src/SMESHGUI/SMESHGUI_Selection.cxx | 34 ++++++++++++++--------------- src/SMESHGUI/SMESHGUI_Selection.h | 2 -- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/src/SMESHGUI/SMESHGUI_Selection.cxx b/src/SMESHGUI/SMESHGUI_Selection.cxx index 6f59abd8c..5abe5c5be 100644 --- a/src/SMESHGUI/SMESHGUI_Selection.cxx +++ b/src/SMESHGUI/SMESHGUI_Selection.cxx @@ -43,8 +43,6 @@ #include #include #include -#include -#include // IDL includes #include @@ -79,8 +77,6 @@ void SMESHGUI_Selection::init( const QString& client, LightApp_SelectionMgr* mgr if( mgr ) { - myOwners.clear(); - mgr->selected(myOwners, client); for( int i=0, n=count(); i= 0 && ind < myTypes.count()) { - if (isReference(ind)) { - SUIT_DataOwner* aOwn = myOwners.at(ind); - LightApp_DataOwner* sowner = dynamic_cast(aOwn); - QString aEntry = sowner->entry(); - _PTR(SObject) aSObject = SMESH::getStudy()->FindObjectID(aEntry.toStdString()); - _PTR(SObject) aFatherObj = aSObject->GetFather(); - _PTR(SComponent) aComponent = aFatherObj->GetFatherComponent(); - if (aComponent->ComponentDataType() == "SMESH") { - QString aObjEntry = entry(ind); - _PTR(SObject) aGeomSObject = SMESH::getStudy()->FindObjectID(aObjEntry.toStdString()); - GEOM::GEOM_Object_var aObject = SMESH::SObjectToInterface(aGeomSObject); - if (!aObject->_is_nil()) - return aObject->IsParametrical(); + if ( ind >= 0 && isReference(ind) ) { + QString aEntry = objectInfo(ind, OI_RefEntry).toString(); + if (!aEntry.isEmpty()) { + _PTR(SObject) aSObject = SMESH::getStudy()->FindObjectID( aEntry.toStdString()); + if (aSObject) { + _PTR(SObject) aFatherObj = aSObject->GetFather(); + if (aFatherObj) { + _PTR(SComponent) aComponent = aFatherObj->GetFatherComponent(); + if (aComponent && aComponent->ComponentDataType() == "SMESH") { + QString aObjEntry = entry(ind); + _PTR(SObject) aGeomSObject = SMESH::getStudy()->FindObjectID(aObjEntry.toStdString()); + GEOM::GEOM_Object_var aObject = SMESH::SObjectToInterface(aGeomSObject); + if (!aObject->_is_nil()) + return aObject->IsParametrical(); + } + } } } } diff --git a/src/SMESHGUI/SMESHGUI_Selection.h b/src/SMESHGUI/SMESHGUI_Selection.h index 5d23e768f..e4b0641e0 100644 --- a/src/SMESHGUI/SMESHGUI_Selection.h +++ b/src/SMESHGUI/SMESHGUI_Selection.h @@ -32,7 +32,6 @@ // SALOME GUI includes #include -#include // SALOME KERNEL includes #include @@ -97,7 +96,6 @@ private: QStringList myTypes; QStringList myControls; QList myActors; - SUIT_DataOwnerPtrList myOwners; }; #endif // SMESHGUI_SELECTION_H -- 2.39.2