[Bf-blender-cvs] [dbc054bb881] master: Fix T89374: Erasing/cutting in Grease Pencil makes Blender shut down

Antonio Vazquez noreply at git.blender.org
Tue Jun 22 23:12:09 CEST 2021


Commit: dbc054bb8818b51c8148a9e245cd75e0198515a0
Author: Antonio Vazquez
Date:   Tue Jun 22 23:11:46 2021 +0200
Branches: master
https://developer.blender.org/rBdbc054bb8818b51c8148a9e245cd75e0198515a0

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..

===================================================================

M	source/blender/blenkernel/intern/gpencil_geom.c

===================================================================

diff --git a/source/blender/blenkernel/intern/gpencil_geom.c b/source/blender/blenkernel/intern/gpencil_geom.c
index 7f839650f33..982fc2abd65 100644
--- a/source/blender/blenkernel/intern/gpencil_geom.c
+++ b/source/blender/blenkernel/intern/gpencil_geom.c
@@ -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 {



More information about the Bf-blender-cvs mailing list