Fix T96233: Crash with gpencil data with vertex groups

Blender crashes when a multi-user grease pencil object has vertex
groups and is modified by modifiers, layer transform or parenting.

The fix makes sure that we copy the vertex group names list.

Reviewed By: antoniov

Maniphest Tasks: T96233

Differential Revision: https://developer.blender.org/D14275
This commit is contained in:
Falk David 2022-03-09 11:21:39 +01:00
parent 04e89c5b06
commit 010ea688f1
Notes: blender-bot 2023-02-14 10:14:07 +01:00
Referenced by issue #96233, GPencil: Crash when multi-user grease pencil object has vertex groups
1 changed files with 3 additions and 0 deletions

View File

@ -28,6 +28,7 @@
#include "DNA_screen_types.h"
#include "BKE_colortools.h"
#include "BKE_deform.h"
#include "BKE_gpencil.h"
#include "BKE_gpencil_geom.h"
#include "BKE_gpencil_modifier.h"
@ -632,6 +633,8 @@ static bGPdata *gpencil_copy_structure_for_eval(bGPdata *gpd)
gpd_eval->mat = MEM_dupallocN(gpd->mat);
}
BKE_defgroup_copy_list(&gpd_eval->vertex_group_names, &gpd->vertex_group_names);
/* Duplicate structure: layers and frames without strokes. */
LISTBASE_FOREACH (bGPDlayer *, gpl_orig, &gpd->layers) {
bGPDlayer *gpl_eval = BKE_gpencil_layer_duplicate(gpl_orig, true, false);