Fix T71712: Free the dynamic mesh preview when rebuilding the PBVH

The PBVH usually is rebuild after a topology change, so it does not make
sense to keep the previous dynamic mesh preview vertex list. This may
cause a crash is the number of vertices of the new mesh (and preview) is
larger previous one. Now the list is deleted with the PBVH and a new one
will be generated using the new mesh when the cursor is updated.

Reviewed By: jbakker

Maniphest Tasks: T71712

Differential Revision: https://developer.blender.org/D6476
This commit is contained in:
Pablo Dobarro
2020-01-10 18:05:57 +01:00
parent eb9401e9af
commit 22f5edcf45

View File

@@ -1019,15 +1019,12 @@ static void sculptsession_free_pbvh(Object *object)
ss->pbvh = NULL;
}
if (ss->pmap) {
MEM_freeN(ss->pmap);
ss->pmap = NULL;
}
MEM_SAFE_FREE(ss->pmap);
if (ss->pmap_mem) {
MEM_freeN(ss->pmap_mem);
ss->pmap_mem = NULL;
}
MEM_SAFE_FREE(ss->pmap_mem);
MEM_SAFE_FREE(ss->preview_vert_index_list);
ss->preview_vert_index_count = 0;
}
void BKE_sculptsession_bm_to_me_for_render(Object *object)