瀏覽代碼

task: Prevent "unexpected task state" when cancelling task sometimes

rdb 4 年之前
父節點
當前提交
91a6ff1d81
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      panda/src/event/asyncFuture.cxx

+ 5 - 0
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);