From: eap Date: Mon, 22 Jul 2013 14:29:04 +0000 (+0000) Subject: SALOME Forum bug: sub-mesh removal leads to an Exception in a re-opened study. X-Git-Tag: V7_3_0a1~267 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6a8e2f83ff4c6f3f76affef3ce5f552c3cc189e3;p=modules%2Fsmesh.git SALOME Forum bug: sub-mesh removal leads to an Exception in a re-opened study. + void UnRegisterFilters(); --- diff --git a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx index df5618fc2..76e4b703b 100755 --- a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx @@ -1970,6 +1970,10 @@ void SMESHGUI_FilterTable::onCriterionChanged (const int row, const int col, con { isThresholdEditable = true; } + if ( !isThresholdEditable ) + { + aTable->setItem( row, 2, new QTableWidgetItem() ); + } aTable->setEditable( isThresholdEditable, row, 2); @@ -3323,6 +3327,8 @@ bool SMESHGUI_FilterDlg::createFilter (const int theType) aCriteria[ i ] = aCriterion; } + if ( !myFilter[ theType ]->_is_nil() ) + myFilter[ theType ]->UnRegister(); myFilter[ theType ] = aFilterMgr->CreateFilter(); 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) { + if ( !filter->_is_nil() ) + filter->Register(); + if ( !myFilter[ type ]->_is_nil() ) + myFilter[ type ]->UnRegister(); + 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 // Purpose : Insert filter in viewer diff --git a/src/SMESHGUI/SMESHGUI_FilterDlg.h b/src/SMESHGUI/SMESHGUI_FilterDlg.h index 200973790..157869821 100755 --- a/src/SMESHGUI/SMESHGUI_FilterDlg.h +++ b/src/SMESHGUI/SMESHGUI_FilterDlg.h @@ -234,6 +234,7 @@ public: SMESH::Filter_var GetFilter() const; void SetFilter(SMESH::Filter_var filter, int type); + void UnRegisterFilters(); signals: