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

+  void                      UnRegisterFilters();
This commit is contained in:
eap 2013-07-22 14:29:04 +00:00
parent 91084ee58a
commit 6a8e2f83ff
2 changed files with 27 additions and 0 deletions

View File

@ -1970,6 +1970,10 @@ void SMESHGUI_FilterTable::onCriterionChanged (const int row, const int col, con
{ {
isThresholdEditable = true; isThresholdEditable = true;
} }
if ( !isThresholdEditable )
{
aTable->setItem( row, 2, new QTableWidgetItem() );
}
aTable->setEditable( isThresholdEditable, row, 2); aTable->setEditable( isThresholdEditable, row, 2);
@ -3323,6 +3327,8 @@ bool SMESHGUI_FilterDlg::createFilter (const int theType)
aCriteria[ i ] = aCriterion; aCriteria[ i ] = aCriterion;
} }
if ( !myFilter[ theType ]->_is_nil() )
myFilter[ theType ]->UnRegister();
myFilter[ theType ] = aFilterMgr->CreateFilter(); myFilter[ theType ] = aFilterMgr->CreateFilter();
myFilter[ theType ]->SetCriteria(aCriteria.inout()); myFilter[ theType ]->SetCriteria(aCriteria.inout());
@ -3356,9 +3362,29 @@ SMESH::Filter_var SMESHGUI_FilterDlg::GetFilter() const
void SMESHGUI_FilterDlg::SetFilter(SMESH::Filter_var filter, int type) void SMESHGUI_FilterDlg::SetFilter(SMESH::Filter_var filter, int type)
{ {
if ( !filter->_is_nil() )
filter->Register();
if ( !myFilter[ type ]->_is_nil() )
myFilter[ type ]->UnRegister();
myFilter[ type ] = filter; myFilter[ type ] = filter;
} }
//================================================================================
/*!
* \brief call UnRegister() for myFilter's
*/
//================================================================================
void SMESHGUI_FilterDlg::UnRegisterFilters()
{
QMap< int, SMESH::Filter_var >::iterator i_f = myFilter.begin();
for ( ; i_f != myFilter.end(); ++i_f )
if ( !i_f.value()->_is_nil() )
i_f.value()->UnRegister();
myFilter.clear();
}
//======================================================================= //=======================================================================
// name : SMESHGUI_FilterDlg::insertFilterInViewer // name : SMESHGUI_FilterDlg::insertFilterInViewer
// Purpose : Insert filter in viewer // Purpose : Insert filter in viewer

View File

@ -234,6 +234,7 @@ public:
SMESH::Filter_var GetFilter() const; SMESH::Filter_var GetFilter() const;
void SetFilter(SMESH::Filter_var filter, int type); void SetFilter(SMESH::Filter_var filter, int type);
void UnRegisterFilters();
signals: signals: