bos #19219 [CEA] SIGSEGV when right-click in the view in 3D layers dialog box

This commit is contained in:
vsr 2020-06-15 18:44:50 +03:00
parent 1a39b08ad9
commit 9beb8d2764
2 changed files with 16 additions and 20 deletions

View File

@ -43,8 +43,6 @@
#include <SalomeApp_Application.h> #include <SalomeApp_Application.h>
#include <LightApp_VTKSelector.h> #include <LightApp_VTKSelector.h>
#include <SVTK_ViewWindow.h> #include <SVTK_ViewWindow.h>
#include <LightApp_SelectionMgr.h>
#include <LightApp_DataOwner.h>
// IDL includes // IDL includes
#include <SALOMEconfig.h> #include <SALOMEconfig.h>
@ -79,8 +77,6 @@ void SMESHGUI_Selection::init( const QString& client, LightApp_SelectionMgr* mgr
if( mgr ) if( mgr )
{ {
myOwners.clear();
mgr->selected(myOwners, client);
for( int i=0, n=count(); i<n; i++ ) { for( int i=0, n=count(); i<n; i++ ) {
myTypes.append( typeName( type( entry( i ) ) ) ); myTypes.append( typeName( type( entry( i ) ) ) );
myControls.append( controlMode( i ) ); myControls.append( controlMode( i ) );
@ -617,20 +613,22 @@ bool SMESHGUI_Selection::hasGeomReference( int ind ) const
bool SMESHGUI_Selection::canBreakLink( int ind ) const bool SMESHGUI_Selection::canBreakLink( int ind ) const
{ {
if ( ind >= 0 && ind < myTypes.count()) { if ( ind >= 0 && isReference(ind) ) {
if (isReference(ind)) { QString aEntry = objectInfo(ind, OI_RefEntry).toString();
SUIT_DataOwner* aOwn = myOwners.at(ind); if (!aEntry.isEmpty()) {
LightApp_DataOwner* sowner = dynamic_cast<LightApp_DataOwner*>(aOwn); _PTR(SObject) aSObject = SMESH::getStudy()->FindObjectID( aEntry.toStdString());
QString aEntry = sowner->entry(); if (aSObject) {
_PTR(SObject) aSObject = SMESH::getStudy()->FindObjectID(aEntry.toStdString()); _PTR(SObject) aFatherObj = aSObject->GetFather();
_PTR(SObject) aFatherObj = aSObject->GetFather(); if (aFatherObj) {
_PTR(SComponent) aComponent = aFatherObj->GetFatherComponent(); _PTR(SComponent) aComponent = aFatherObj->GetFatherComponent();
if (aComponent->ComponentDataType() == "SMESH") { if (aComponent && aComponent->ComponentDataType() == "SMESH") {
QString aObjEntry = entry(ind); QString aObjEntry = entry(ind);
_PTR(SObject) aGeomSObject = SMESH::getStudy()->FindObjectID(aObjEntry.toStdString()); _PTR(SObject) aGeomSObject = SMESH::getStudy()->FindObjectID(aObjEntry.toStdString());
GEOM::GEOM_Object_var aObject = SMESH::SObjectToInterface<GEOM::GEOM_Object>(aGeomSObject); GEOM::GEOM_Object_var aObject = SMESH::SObjectToInterface<GEOM::GEOM_Object>(aGeomSObject);
if (!aObject->_is_nil()) if (!aObject->_is_nil())
return aObject->IsParametrical(); return aObject->IsParametrical();
}
}
} }
} }
} }

View File

@ -32,7 +32,6 @@
// SALOME GUI includes // SALOME GUI includes
#include <LightApp_Selection.h> #include <LightApp_Selection.h>
#include <SUIT_DataOwner.h>
// SALOME KERNEL includes // SALOME KERNEL includes
#include <SALOMEDSClient_definitions.hxx> #include <SALOMEDSClient_definitions.hxx>
@ -97,7 +96,6 @@ private:
QStringList myTypes; QStringList myTypes;
QStringList myControls; QStringList myControls;
QList<SMESH_Actor*> myActors; QList<SMESH_Actor*> myActors;
SUIT_DataOwnerPtrList myOwners;
}; };
#endif // SMESHGUI_SELECTION_H #endif // SMESHGUI_SELECTION_H