- LightApp_SelectionMgr* mgr = selectionMgr();
- if( !mgr )
- return;
-
- Filters::const_iterator anIt = myFilters.begin(),
- aLast = myFilters.end();
- for( ; anIt!=aLast; anIt++ )
- if( anIt.data() )
- mgr->removeFilter( anIt.data() );
+ if (myFilters.count() > 0) {
+ LightApp_SelectionMgr* mgr = selectionMgr();
+ Filters::const_iterator anIt = myFilters.begin(),
+ aLast = myFilters.end();
+ for (; anIt != aLast; anIt++) {
+ if (anIt.data()) {
+ if (mgr) mgr->removeFilter(anIt.data());
+ delete anIt.data();
+ }
+ }
+
+ myFilters.clear();
+ }