Fix ugly mistake in BLI_task - freeing while some tasks are still being processed.
authorBastien Montagne <montagne29@wanadoo.fr>
Fri, 3 Mar 2017 16:12:03 +0000 (17:12 +0100)
committerBastien Montagne <montagne29@wanadoo.fr>
Fri, 3 Mar 2017 16:12:03 +0000 (17:12 +0100)
commit18c2a443336dea839c028dcc98f8021b98c2a5ca
treebe51e3a1cbd91da85ce850e2afbfdb384fccffac
parent5f05dac28fdfe4e97fb553ee38144cdb7fe9fbd5
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.
source/blender/blenlib/intern/task.c