Fix T81976: Cycles crash after recent geometry sync multithreading change

Avoid accessing mesh emitter and hair at the same time. This is not ideal for
performance, but once we have a dedicated hair object this will resolve itself.

Differential Revision: https://developer.blender.org/D9322
This commit is contained in:
Olivier Maury 2020-10-23 17:13:21 +02:00 committed by Brecht Van Lommel
parent 0d1b1c341f
commit 559e87ad08

@ -393,6 +393,11 @@ void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph,
/* Load per-object culling data. */
culling.init_object(scene, b_ob);
/* Ensure the object geom supporting the hair is processed before adding
* the hair processing task to the task pool, calling .to_mesh() on the
* same object in parallel does not work. */
const bool sync_hair = b_instance.show_particles() && object_has_particle_hair(b_ob);
/* Object itself. */
if (b_instance.show_self()) {
sync_object(b_depsgraph,
@ -403,11 +408,11 @@ void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph,
show_lights,
culling,
&use_portal,
&geom_task_pool);
sync_hair ? NULL : &geom_task_pool);
}
/* Particle hair as separate object. */
if (b_instance.show_particles() && object_has_particle_hair(b_ob)) {
if (sync_hair) {
sync_object(b_depsgraph,
b_view_layer,
b_instance,