From 224a32090f843c11dd408434981266ab57587bbd Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 26 Jul 2019 08:27:31 +0200 Subject: [PATCH] task: fix other task chains still running after exception occurs A task returning DS_interrupt would only interrupt the current task chain, not the entire task manager. This meant that other tasks might get run with an exception state set, causing the exception state to get stomped on or the Python interpreter to complain. Fixes #692 --- panda/src/event/asyncTaskManager.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/panda/src/event/asyncTaskManager.cxx b/panda/src/event/asyncTaskManager.cxx index a570609f8a..b10c7ea935 100644 --- a/panda/src/event/asyncTaskManager.cxx +++ b/panda/src/event/asyncTaskManager.cxx @@ -480,6 +480,12 @@ poll() { for (unsigned int i = 0; i < _task_chains.size(); ++i) { AsyncTaskChain *chain = _task_chains[i]; chain->do_poll(); + + if (chain->_state == AsyncTaskChain::S_interrupted) { + // If a task returned DS_interrupt, we need to interrupt the entire + // manager, since an exception state may have been set. + break; + } } // Just in case the clock was ticked explicitly by one of our polling