From 997c16d89decd85389b313bc11f071b3e47f7fc4 Mon Sep 17 00:00:00 2001 From: eap Date: Mon, 22 Jul 2013 14:35:30 +0000 Subject: [PATCH] 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 --- src/SMESHGUI/SMESHGUI_GroupDlg.cxx | 34 ++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx index f0e6f7f63..832ac1c8d 100644 --- a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx @@ -38,7 +38,7 @@ #include #include -#include +//#include #include // SALOME GEOM includes @@ -921,7 +921,7 @@ bool SMESHGUI_GroupDlg::onApply() QStringList anEntryList; SMESH::SMESH_GroupBase_var resultGroup; - bool isCreation; + bool isCreation, isConversion = false; if (myGrpTypeId == 0) // standalone { @@ -940,8 +940,9 @@ bool SMESHGUI_GroupDlg::onApply() else myGroup = myMesh->ConvertToStandalone( myGroupOnGeom ); - myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil(); + myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil(); myGroupOnFilter = SMESH::SMESH_GroupOnFilter::_nil(); + isConversion = true; } } @@ -1150,7 +1151,17 @@ bool SMESHGUI_GroupDlg::onApply() resultGroup->SetName(myName->text().toLatin1().data()); if ( aMeshGroupSO ) + { 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()); QColor c; int delta; @@ -1160,16 +1171,17 @@ bool SMESHGUI_GroupDlg::onApply() case grpBallSelection: anActor->SetBallColor( aColor.R, aColor.G, aColor.B ); break; case grpEdgeSelection: anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B ); break; case grpVolumeSelection: - SMESH::GetColor("SMESH", "volume_color", c , delta, "255,0,170|-100"); - anActor->SetVolumeColor( aColor.R, aColor.G, aColor.B, delta ); break; - break; + SMESH::GetColor("SMESH", "volume_color", c , delta, "255,0,170|-100"); + anActor->SetVolumeColor( aColor.R, aColor.G, aColor.B, delta ); break; + break; case grpFaceSelection: default: - SMESH::GetColor("SMESH", "fill_color", c , delta, "0,170,255|-100"); - anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B, delta ); break; - break; + SMESH::GetColor("SMESH", "fill_color", c , delta, "0,170,255|-100"); + anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B, delta ); break; + break; } } + } } SMESHGUI::Modified(); mySMESHGUI->updateObjBrowser(true); @@ -1193,6 +1205,8 @@ void SMESHGUI_GroupDlg::onOK() if ( onApply() ) reject(); setIsApplyAndClose( false ); + + if ( myFilterDlg ) myFilterDlg->UnRegisterFilters(); } //================================================================================= @@ -2202,6 +2216,8 @@ void SMESHGUI_GroupDlg::reject() mySMESHGUI->ResetState(); QDialog::reject(); + + if ( myFilterDlg ) myFilterDlg->UnRegisterFilters(); } //================================================================================= -- 2.39.2