Page MenuHome

Fix threading issues when extracting mesh data for drawing

Authored by Jacques Lucke (JacquesLucke) on Wed, Sep 4, 7:31 PM.



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:

  1. The extract_pos_nor_init function is called.
  2. Tasks are added to the task pool for extract_pos_nor.
  3. The tasks begin to be executed while more tasks are added.
  4. In some rare cases, all existing tasks are finished, but not all have been added yet.
  5. This let the task-counter go down to zero.
  6. This triggered a call to extract_pos_nor_finish.
  7. 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.

Diff Detail

rB Blender

Event Timeline

This revision is now accepted and ready to land.Wed, Sep 4, 8:12 PM