Fix T89374: Erasing/cutting in Grease Pencil makes Blender shut down

When cut a stroke of 1 point, the clean up done to avoid keep 1 point strokes removes the memory, but the pointer to the first stroke was not set to NULL. As this pointer is invalid now, any use of this produces a segment fault because the pointer is corrupted..
This commit is contained in:
Antonio Vazquez 2021-06-22 23:11:46 +02:00
parent abb07a38b8
commit dbc054bb88
Notes: blender-bot 2023-02-13 23:16:02 +01:00
Referenced by issue #89374, Erasing/cutting in Grease Pencil makes Blender shut down.
1 changed files with 3 additions and 0 deletions

View File

@ -2984,6 +2984,9 @@ bGPDstroke *BKE_gpencil_stroke_delete_tagged_points(bGPdata *gpd,
/* Add new stroke to the frame or delete if below limit */
if ((limit > 0) && (new_stroke->totpoints <= limit)) {
if (gps_first == new_stroke) {
gps_first = NULL;
}
BKE_gpencil_free_stroke(new_stroke);
}
else {