From 3dbd9c9ecab5331d315a665790e3126529420c23 Mon Sep 17 00:00:00 2001 From: matejcik Date: Fri, 22 May 2020 12:00:38 +0200 Subject: [PATCH] core/loop: prevent finalizers from doing things when task is closed externally --- core/src/trezor/loop.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/trezor/loop.py b/core/src/trezor/loop.py index cb73343ce..e6f122dad 100644 --- a/core/src/trezor/loop.py +++ b/core/src/trezor/loop.py @@ -341,6 +341,8 @@ class race(Syscall): except: # noqa: E722 # exception was raised on the waiting task externally with # close() or throw(), kill the children tasks and re-raise + # Make sure finalizers don't continue processing. + self.finished.append(self) self.exit() raise