Fix infinite recursion

Force the Results to update its internal __dupes list whenever at least one group has re-prioritized and changed its dupes/ref.
This commit is contained in:
glubsy 2021-06-23 05:36:10 +02:00
parent 2f8d603251
commit 23c59787e5
2 changed files with 20 additions and 15 deletions

View File

@ -770,6 +770,8 @@ class DupeGuru(Broadcaster):
for group in self.results.groups:
if group.prioritize(key_func=sort_key):
count += 1
if count:
self.results.refresh_required = True
self._results_changed()
msg = tr("{} duplicate groups were changed by the re-prioritization.").format(
count

View File

@ -52,6 +52,7 @@ class Results(Markable):
self.app = app
self.problems = [] # (dupe, error_msg)
self.is_modified = False
self.refresh_required = False
def _did_mark(self, dupe):
self.__marked_size += dupe.size
@ -94,7 +95,9 @@ class Results(Markable):
# ---Private
def __get_dupe_list(self):
if self.__dupes is None or self.refresh_required:
self.__dupes = flatten(group.dupes for group in self.groups)
self.refresh_required = False
if None in self.__dupes:
# This is debug logging to try to figure out #44
logging.warning(