Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2017-03-03 19:12:03 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2017-03-03 19:12:03 +0300
commit18c2a443336dea839c028dcc98f8021b98c2a5ca (patch)
treebe51e3a1cbd91da85ce850e2afbfdb384fccffac
parent5f05dac28fdfe4e97fb553ee38144cdb7fe9fbd5 (diff)
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.
-rw-r--r--source/blender/blenlib/intern/task.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/task.c b/source/blender/blenlib/intern/task.c
index 5286e6ffb96..359360d59c4 100644
--- a/source/blender/blenlib/intern/task.c
+++ b/source/blender/blenlib/intern/task.c
@@ -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);