Fix T68645: Hair Particle Edit - Particle Mirror crash when children are
authorPhilipp Oeser <info@graphics-engineer.com>
Wed, 11 Sep 2019 11:33:29 +0000 (13:33 +0200)
committerPhilipp Oeser <info@graphics-engineer.com>
Thu, 26 Sep 2019 15:35:17 +0000 (17:35 +0200)
visible in the viewport

Seems to be an issue of not correctly freeing the PTCacheEdit (see
T68645 for details), after discussion with sergey we went with the quick
and dirty fix to free the path cache early for now. Other solution of
freeing it in 'psys_cache_paths' for the non-evaluated psys [which would
also fix the particle delete, then undo crash from T69000] needs more
deep investigation and, possibly, reconsideration.

Reviewers: sergey

Maniphest Tasks: T68645

Differential Revision: https://developer.blender.org/D5755

source/blender/editors/physics/particle_edit.c

index 1e6ff16322503649ed3983ce197235e1dbe0e6cd..1e2722ae77671b89c52cc6956337ecd5890b9055 100644 (file)
@@ -3539,7 +3539,10 @@ static int mirror_exec(bContext *C, wmOperator *UNUSED(op))
   PE_mirror_x(depsgraph, scene, ob, 0);
 
   update_world_cos(ob, edit);
+  psys_free_path_cache(NULL, edit);
+
   WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE | NA_EDITED, ob);
+  BKE_particle_batch_cache_dirty_tag(edit->psys, BKE_PARTICLE_BATCH_DIRTY_ALL);
   DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
 
   return OPERATOR_FINISHED;