[Bf-blender-cvs] [e545a50e2a2] greasepencil-object: Fix segment fault when using eraser
Antonio Vazquez
noreply at git.blender.org
Sun May 21 19:40:32 CEST 2017
Commit: e545a50e2a2d23bf14bcb7e57db6b151f669a8eb
Author: Antonio Vazquez
Date: Sun May 21 19:40:08 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rBe545a50e2a2d23bf14bcb7e57db6b151f669a8eb
Fix segment fault when using eraser
The cache must be marked as dirty after any change operation, and the eraser change the strokes
===================================================================
M source/blender/editors/gpencil/gpencil_edit.c
M source/blender/editors/gpencil/gpencil_paint.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index a74d1963cb2..e7c780c2535 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -357,7 +357,7 @@ void ED_gpencil_strokes_copybuf_free(void)
if (gps->points) MEM_freeN(gps->points);
if (gps->triangles) MEM_freeN(gps->triangles);
-
+
BLI_freelinkN(&gp_strokes_copypastebuf, gps);
}
@@ -931,7 +931,7 @@ static int gp_delete_selected_strokes(bContext *C)
if (gps->points) MEM_freeN(gps->points);
if (gps->triangles) MEM_freeN(gps->triangles);
BLI_freelinkN(&gpf->strokes, gps);
-
+
changed = true;
}
}
@@ -999,6 +999,7 @@ static int gp_dissolve_selected_points(bContext *C)
MEM_freeN(gps->triangles);
}
BLI_freelinkN(&gpf->strokes, gps);
+ BKE_gpencil_batch_cache_dirty(gpd, 0);
}
else {
/* just copy all unselected into a smaller buffer */
@@ -1201,7 +1202,7 @@ static int gp_delete_selected_points(bContext *C)
/* delete unwanted points by splitting stroke into several smaller ones */
gp_stroke_delete_tagged_points(gpf, gps, gpsn, GP_SPOINT_SELECT);
-
+
changed = true;
}
}
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index c8dbf108def..409e0175f1a 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1141,6 +1141,7 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p,
if (gps->triangles)
MEM_freeN(gps->triangles);
BLI_freelinkN(&gpf->strokes, gps);
+ BKE_gpencil_batch_cache_dirty(p->gpd, 0);
}
else if (gps->totpoints == 1) {
/* only process if it hasn't been masked out... */
@@ -1158,6 +1159,7 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p,
if (gps->triangles)
MEM_freeN(gps->triangles);
BLI_freelinkN(&gpf->strokes, gps);
+ BKE_gpencil_batch_cache_dirty(p->gpd, 0);
}
}
}
@@ -1245,6 +1247,7 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p,
if (do_cull) {
gp_stroke_delete_tagged_points(gpf, gps, gps->next, GP_SPOINT_TAG);
}
+ BKE_gpencil_batch_cache_dirty(p->gpd, 0);
}
}
More information about the Bf-blender-cvs
mailing list