I got some "random" crashes in the functions branch. Eventually, I
tracked it down to a double free in the extract-mesh code.
I believed this happened because:
- The extract_pos_nor_init function is called.
- Tasks are added to the task pool for extract_pos_nor.
- The tasks begin to be executed while more tasks are added.
- In some rare cases, all existing tasks are finished, but not all have been added yet.
- This let the task-counter go down to zero.
- This triggered a call to extract_pos_nor_finish.
- Then more tasks are added and in the end extract_pos_nor_finish is called again.
The solution is to use a task pool that is suspended when created.
Unfortunately, there was an outdated comment, that was probably the root cause of the issue.