From 91a6ff1d81bd3626d356f114b061e142aa3b2af7 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 11 May 2021 11:30:41 +0200 Subject: [PATCH] task: Prevent "unexpected task state" when cancelling task sometimes --- panda/src/event/asyncFuture.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/panda/src/event/asyncFuture.cxx b/panda/src/event/asyncFuture.cxx index 6828213942..b1c8ce0fc3 100644 --- a/panda/src/event/asyncFuture.cxx +++ b/panda/src/event/asyncFuture.cxx @@ -315,6 +315,11 @@ wake_task(AsyncTask *task) { task->_state = AsyncTask::S_servicing; return; + case AsyncTask::S_active: + // It could have already been activated, such as by a cancel() which then + // indirectly caused the awaiting future to be cancelled. Do nothing. + return; + case AsyncTask::S_inactive: // Schedule it immediately. nassertv(task->_manager == nullptr);