[Bf-blender-cvs] [665efe401aa] blender2.8: Fix T57611: Crash on entering Grease Pencil Sculpt Mode

Antonioya noreply at git.blender.org
Sun Nov 4 19:37:27 CET 2018


Commit: 665efe401aa91b3b90dc03dac2df187c249f3ae6
Author: Antonioya
Date:   Sun Nov 4 19:37:03 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB665efe401aa91b3b90dc03dac2df187c249f3ae6

Fix T57611: Crash on entering Grease Pencil Sculpt Mode

The problem was when some layers was locked in multiedit. The cache size was not checked and gets an segment fault.

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

M	source/blender/draw/engines/gpencil/gpencil_draw_utils.c

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

diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index abf1940ad4a..79ad855108e 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -891,19 +891,23 @@ static void gpencil_draw_strokes(
 
 		/* edit points (only in edit mode and not play animation not render) */
 		if ((draw_ctx->obact == ob) && (src_gps) &&
-		    (!playing) && (!is_render) && (!cache_ob->is_dup_ob) &&
-		    ((gpl->flag & GP_LAYER_LOCKED) == 0))
+		    (!playing) && (!is_render) && (!cache_ob->is_dup_ob))
 		{
-			if (!stl->g_data->shgrps_edit_line) {
-				stl->g_data->shgrps_edit_line = DRW_shgroup_create(e_data->gpencil_line_sh, psl->edit_pass);
+			if ((gpl->flag & GP_LAYER_LOCKED) == 0) {
+				if (!stl->g_data->shgrps_edit_line) {
+					stl->g_data->shgrps_edit_line = DRW_shgroup_create(e_data->gpencil_line_sh, psl->edit_pass);
+				}
+				if (!stl->g_data->shgrps_edit_point) {
+					stl->g_data->shgrps_edit_point = DRW_shgroup_create(e_data->gpencil_edit_point_sh, psl->edit_pass);
+					const float *viewport_size = DRW_viewport_size_get();
+					DRW_shgroup_uniform_vec2(stl->g_data->shgrps_edit_point, "Viewport", viewport_size, 1);
+				}
+
+				gpencil_add_editpoints_shgroup(stl, cache, ts, ob, gpd, gpl, derived_gpf, src_gps);
 			}
-			if (!stl->g_data->shgrps_edit_point) {
-				stl->g_data->shgrps_edit_point = DRW_shgroup_create(e_data->gpencil_edit_point_sh, psl->edit_pass);
-				const float *viewport_size = DRW_viewport_size_get();
-				DRW_shgroup_uniform_vec2(stl->g_data->shgrps_edit_point, "Viewport", viewport_size, 1);
+			else {
+				gpencil_batch_cache_check_free_slots(ob);
 			}
-
-			gpencil_add_editpoints_shgroup(stl, cache, ts, ob, gpd, gpl, derived_gpf, src_gps);
 		}
 
 		GP_SET_SRC_GPS(src_gps);



More information about the Bf-blender-cvs mailing list