SALOME Forum bug: sub-mesh removal leads to an Exception in a re-opened study.

1) call myFilterDlg->UnRegisterFilters();
2) re-create an actor after converting a group to standalone as a
CORBA object becomes different from that held by the actor
This commit is contained in:
eap 2013-07-22 14:35:30 +00:00
parent 6a8e2f83ff
commit 997c16d89d

View File

@ -38,7 +38,7 @@
#include <SMESH_TypeFilter.hxx> #include <SMESH_TypeFilter.hxx>
#include <SMESH_Actor.h> #include <SMESH_Actor.h>
#include <SMESH_ActorUtils.h> //#include <SMESH_ActorUtils.h>
#include <SMESH_LogicalFilter.hxx> #include <SMESH_LogicalFilter.hxx>
// SALOME GEOM includes // SALOME GEOM includes
@ -921,7 +921,7 @@ bool SMESHGUI_GroupDlg::onApply()
QStringList anEntryList; QStringList anEntryList;
SMESH::SMESH_GroupBase_var resultGroup; SMESH::SMESH_GroupBase_var resultGroup;
bool isCreation; bool isCreation, isConversion = false;
if (myGrpTypeId == 0) // standalone if (myGrpTypeId == 0) // standalone
{ {
@ -940,8 +940,9 @@ bool SMESHGUI_GroupDlg::onApply()
else else
myGroup = myMesh->ConvertToStandalone( myGroupOnGeom ); myGroup = myMesh->ConvertToStandalone( myGroupOnGeom );
myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil(); myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
myGroupOnFilter = SMESH::SMESH_GroupOnFilter::_nil(); myGroupOnFilter = SMESH::SMESH_GroupOnFilter::_nil();
isConversion = true;
} }
} }
@ -1150,7 +1151,17 @@ bool SMESHGUI_GroupDlg::onApply()
resultGroup->SetName(myName->text().toLatin1().data()); resultGroup->SetName(myName->text().toLatin1().data());
if ( aMeshGroupSO ) if ( aMeshGroupSO )
{
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(aMeshGroupSO->GetID().c_str())) { if(SMESH_Actor *anActor = SMESH::FindActorByEntry(aMeshGroupSO->GetID().c_str())) {
if ( isConversion ) { // need to reset TVisualObj and actor
Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
SMESH::RemoveVisualObjectWithActors( anIO->getEntry(), true );
SMESH::Update( anIO,true);
myActorsList.clear();
anActor = SMESH::FindActorByEntry( anIO->getEntry() );
if ( !anActor ) return false;
myActorsList.append( anActor );
}
anActor->setName(myName->text().toLatin1().data()); anActor->setName(myName->text().toLatin1().data());
QColor c; QColor c;
int delta; int delta;
@ -1160,16 +1171,17 @@ bool SMESHGUI_GroupDlg::onApply()
case grpBallSelection: anActor->SetBallColor( aColor.R, aColor.G, aColor.B ); break; case grpBallSelection: anActor->SetBallColor( aColor.R, aColor.G, aColor.B ); break;
case grpEdgeSelection: anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B ); break; case grpEdgeSelection: anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B ); break;
case grpVolumeSelection: case grpVolumeSelection:
SMESH::GetColor("SMESH", "volume_color", c , delta, "255,0,170|-100"); SMESH::GetColor("SMESH", "volume_color", c , delta, "255,0,170|-100");
anActor->SetVolumeColor( aColor.R, aColor.G, aColor.B, delta ); break; anActor->SetVolumeColor( aColor.R, aColor.G, aColor.B, delta ); break;
break; break;
case grpFaceSelection: case grpFaceSelection:
default: default:
SMESH::GetColor("SMESH", "fill_color", c , delta, "0,170,255|-100"); SMESH::GetColor("SMESH", "fill_color", c , delta, "0,170,255|-100");
anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B, delta ); break; anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B, delta ); break;
break; break;
} }
} }
}
} }
SMESHGUI::Modified(); SMESHGUI::Modified();
mySMESHGUI->updateObjBrowser(true); mySMESHGUI->updateObjBrowser(true);
@ -1193,6 +1205,8 @@ void SMESHGUI_GroupDlg::onOK()
if ( onApply() ) if ( onApply() )
reject(); reject();
setIsApplyAndClose( false ); setIsApplyAndClose( false );
if ( myFilterDlg ) myFilterDlg->UnRegisterFilters();
} }
//================================================================================= //=================================================================================
@ -2202,6 +2216,8 @@ void SMESHGUI_GroupDlg::reject()
mySMESHGUI->ResetState(); mySMESHGUI->ResetState();
QDialog::reject(); QDialog::reject();
if ( myFilterDlg ) myFilterDlg->UnRegisterFilters();
} }
//================================================================================= //=================================================================================