diff --git a/ChangeLog b/ChangeLog index 5ed26c57c..915002758 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-06-19 Alex Roitman + * src/FilterEditor/_FilterEditor.py (_do_delete_filter): Use a + copy for iteration over the filters. + 2007-06-18 Alex Roitman * src/DateEdit.py (DateEditorDialog.switch_calendar): Only convert non-empty dates to new calendar. diff --git a/src/FilterEditor/_FilterEditor.py b/src/FilterEditor/_FilterEditor.py index 7133a6e12..3626ef494 100644 --- a/src/FilterEditor/_FilterEditor.py +++ b/src/FilterEditor/_FilterEditor.py @@ -212,7 +212,10 @@ class FilterEditor(ManagedWindow.ManagedWindow): and C is 'matches D' the removal of D leads to two broken filter being left behind. """ - filters = self.filterdb.get_filters(space) + # Use the copy of the filter list to iterate over, so that + # the removal of filters does not screw up the iteration + filters = self.filterdb.get_filters(space)[:] + name = gfilter.get_name() for the_filter in filters: for rule in the_filter.get_rules(): @@ -221,7 +224,8 @@ class FilterEditor(ManagedWindow.ManagedWindow): and (name in values): self._do_delete_filter(space,the_filter) break - filters.remove(gfilter) + # The actual removal is from the real filter list, not a copy. + self.filterdb.get_filters(space).remove(gfilter) def get_all_handles(self): if self.space == 'Person':