From c0d8a14ae3466cb97386f950fff9720ebda5ba43 Mon Sep 17 00:00:00 2001 From: Pablo Dobarro Date: Fri, 26 Feb 2021 18:34:41 +0100 Subject: Fix crash with dyntopo on tools that use cached vertex info Tools can cache data related to the mesh topology for later use. This data is indexed by vertex index, so it will be invalid after dyntopo changes the topology during the stroke. Reviewed By: JacquesLucke Differential Revision: https://developer.blender.org/D10550 --- source/blender/editors/sculpt_paint/sculpt.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/blender') diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 1b19fa2b976..3a18d7a10de 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -5841,6 +5841,11 @@ static void sculpt_topology_update(Sculpt *sd, return; } + /* Free index based vertex info as it will become invalid after modifying the topology during the + * stroke. */ + MEM_SAFE_FREE(ss->vertex_info.boundary); + MEM_SAFE_FREE(ss->vertex_info.connected_component); + PBVHTopologyUpdateMode mode = 0; float location[3]; -- cgit v1.2.3