From 8278778e65815bc5fe199ff02b65d06cae9c212f Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Tue, 19 Jun 2007 17:09:20 +0000 Subject: [PATCH] 2007-06-19 Alex Roitman * src/FilterEditor/_FilterEditor.py (_do_delete_filter): Use a copy for iteration over the filters. svn: r8597 --- ChangeLog | 4 ++++ src/FilterEditor/_FilterEditor.py | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b16a163ac..5dc10fac7 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 Brian Matherly * src/plugins/DetDescendantReport.py: * src/plugins/DetAncestralReport.py: diff --git a/src/FilterEditor/_FilterEditor.py b/src/FilterEditor/_FilterEditor.py index b4e88537f..4e40e69f6 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':