autotest: copy message hooks while iterating over them for removal

won't remove a number of entries from the end of the list if others have been removed
This commit is contained in:
Peter Barker 2024-06-03 18:26:36 +10:00 committed by Peter Barker
parent 2af6358c07
commit 2a964c44d4
1 changed files with 1 additions and 1 deletions

View File

@ -8456,7 +8456,7 @@ Also, ignores heartbeats not from our target system'''
ex = e
# reset the message hooks; we've failed-via-exception and
# can't expect the hooks to have been cleaned up
for h in self.mav.message_hooks:
for h in copy.copy(self.mav.message_hooks):
if h not in start_message_hooks:
self.mav.message_hooks.remove(h)
hooks_removed = True