Fix #108198: Particle hair crash when using Hair Dynamics #108480

Merged
Hans Goudey merged 2 commits from Chao-Li/blender:fix-hair-dynamics into blender-v3.6-release 2023-06-06 18:46:40 +02:00

2 Commits

Author SHA1 Message Date
Chao Li 08f8b8b266 Update edges in simulation data for every frame in cloth simulation 2023-06-05 10:46:32 -04:00
Chao Li 6df3448c9e Fix #108198: Particle hair crash when using Hair Dynamics
hair_out_mesh and hair_in_mesh implicitly shares edges CustomData. In hair_create_input_mesh(), edge data of hair_in_mesh needs to be updated and therefore a new address is allocated. In the subsequent frames, psys->clmd->clothObject->edges points to freed memory block. Therefore, Blender crashes.
By freeing hair_out_mesh first,
1. in hair_create_input_mesh(), at least edge data copying is avoided
2. psys->clmd->clothObject->edges always points to correct memory
2023-06-05 10:46:32 -04:00