Fix ugly mistake in BLI_task - freeing while some tasks are still being processed.
Freeing pool was calling `BLI_task_pool_stop()`, which only clears pool's tasks that are in TODO queue, whithout ensuring no more tasks from that pool are being processed in worker threads. This could lead to use-after-free random (and seldom) crashes. Now use instead `BLI_task_pool_cancel()`, which does waits for all tasks being processed to finish, before returning.
This commit is contained in:
parent
5f05dac28f
commit
18c2a44333
@ -565,7 +565,7 @@ TaskPool *BLI_task_pool_create_background(TaskScheduler *scheduler, void *userda
|
||||
|
||||
void BLI_task_pool_free(TaskPool *pool)
|
||||
{
|
||||
BLI_task_pool_stop(pool);
|
||||
BLI_task_pool_cancel(pool);
|
||||
|
||||
BLI_mutex_end(&pool->num_mutex);
|
||||
BLI_condition_end(&pool->num_cond);
|
||||
|
Loading…
Reference in New Issue
Block a user