mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
event: fix a crash when removing a task is not owned by user
This commit is contained in:
parent
753ae39740
commit
9ca0d089a6
@ -477,6 +477,7 @@ do_remove(AsyncTask *task, bool upon_death) {
|
|||||||
{
|
{
|
||||||
int index = find_task_on_heap(_sleeping, task);
|
int index = find_task_on_heap(_sleeping, task);
|
||||||
nassertr(index != -1, false);
|
nassertr(index != -1, false);
|
||||||
|
PT(AsyncTask) hold_task = task;
|
||||||
_sleeping.erase(_sleeping.begin() + index);
|
_sleeping.erase(_sleeping.begin() + index);
|
||||||
make_heap(_sleeping.begin(), _sleeping.end(), AsyncTaskSortWakeTime());
|
make_heap(_sleeping.begin(), _sleeping.end(), AsyncTaskSortWakeTime());
|
||||||
cleanup_task(task, upon_death, false);
|
cleanup_task(task, upon_death, false);
|
||||||
@ -486,6 +487,7 @@ do_remove(AsyncTask *task, bool upon_death) {
|
|||||||
case AsyncTask::S_active:
|
case AsyncTask::S_active:
|
||||||
{
|
{
|
||||||
// Active, but not being serviced, easy.
|
// Active, but not being serviced, easy.
|
||||||
|
PT(AsyncTask) hold_task = task;
|
||||||
int index = find_task_on_heap(_active, task);
|
int index = find_task_on_heap(_active, task);
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
_active.erase(_active.begin() + index);
|
_active.erase(_active.begin() + index);
|
||||||
@ -769,7 +771,6 @@ cleanup_task(AsyncTask *task, bool upon_death, bool clean_exit) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
nassertv(task->_chain == this);
|
nassertv(task->_chain == this);
|
||||||
PT(AsyncTask) hold_task = task;
|
|
||||||
|
|
||||||
task->_state = AsyncTask::S_inactive;
|
task->_state = AsyncTask::S_inactive;
|
||||||
task->_chain = nullptr;
|
task->_chain = nullptr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user