[Bf-blender-cvs] [08e49c034b3] blender2.8: GP: Fix unreported segment fault with some old files
Antonioya
noreply at git.blender.org
Wed Aug 8 12:19:27 CEST 2018
Commit: 08e49c034b318fa430f2b783b3a3fac089da5f9b
Author: Antonioya
Date: Wed Aug 8 12:17:00 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB08e49c034b318fa430f2b783b3a3fac089da5f9b
GP: Fix unreported segment fault with some old files
In some corner situations for old files, the weights array could not be initialized properly.
===================================================================
M source/blender/blenkernel/intern/gpencil_modifier.c
===================================================================
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index 3c2196afb18..d1c455f64e1 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -257,6 +257,11 @@ void BKE_gpencil_simplify_stroke(bGPDstroke *gps, float factor)
/* first create temp data and convert points to 2D */
vec2f *points2d = MEM_mallocN(sizeof(vec2f) * gps->totpoints, "GP Stroke temp 2d points");
+ /* for some old files, the weights array could not be initializated */
+ if (gps->dvert == NULL) {
+ gps->dvert = MEM_callocN(sizeof(MDeformVert) * gps->totpoints, "gp_stroke_weights");
+ }
+
gpencil_stroke_project_2d(gps->points, gps->totpoints, points2d);
gpencil_rdp_stroke(gps, points2d, factor);
@@ -271,6 +276,11 @@ void BKE_gpencil_simplify_fixed(bGPDstroke *gps)
return;
}
+ /* for some old files, the weights array could not be initializated */
+ if (gps->dvert == NULL) {
+ gps->dvert = MEM_callocN(sizeof(MDeformVert) * gps->totpoints, "gp_stroke_weights");
+ }
+
/* save points */
bGPDspoint *old_points = MEM_dupallocN(gps->points);
MDeformVert *old_dvert = MEM_dupallocN(gps->dvert);
More information about the Bf-blender-cvs
mailing list