From d1845530aa2844d415b0b9f3ad9fc81398ab6d55 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 9 Jan 2019 22:12:02 +0100 Subject: [PATCH] task: fix mutex recursion when task awaiting other task ends --- panda/src/event/asyncTaskChain.cxx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/panda/src/event/asyncTaskChain.cxx b/panda/src/event/asyncTaskChain.cxx index 34e458691e..1d511bce45 100644 --- a/panda/src/event/asyncTaskChain.cxx +++ b/panda/src/event/asyncTaskChain.cxx @@ -788,18 +788,17 @@ cleanup_task(AsyncTask *task, bool upon_death, bool clean_exit) { _manager->remove_task_by_name(task); - if (upon_death && task->set_future_state(clean_exit ? AsyncFuture::FS_finished - : AsyncFuture::FS_cancelled)) { - task->notify_done(clean_exit); - } - - task->_manager = nullptr; - if (upon_death) { _manager->_lock.unlock(); + if (task->set_future_state(clean_exit ? AsyncFuture::FS_finished + : AsyncFuture::FS_cancelled)) { + task->notify_done(clean_exit); + } task->upon_death(_manager, clean_exit); _manager->_lock.lock(); } + + task->_manager = nullptr; } /**