Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorAntonioya <blendergit@gmail.com>2019-03-05 14:06:37 +0300
committerAntonioya <blendergit@gmail.com>2019-03-05 14:06:55 +0300
commit9f7f4c1a6a838329ce6d11974a9d5595595b6032 (patch)
tree52a7867432e526309735cd5e46cd2a150915338a /source
parent6c513dc3e47d9944ac552f48d6bb0c16dd208074 (diff)
Fix T62194: Blender crash after makingnew file after using Grease Pencil.
The crash was detected in draw_manager, but the real problem was a wrong pointer that corrupted the struct, so the free function failed. Redesign this area to keep pointer correct all the time.
Diffstat (limited to 'source')
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_draw_utils.c9
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_engine.c2
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_engine.h1
3 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 24bb2c9dd14..fb84cd5b612 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -565,9 +565,7 @@ DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(
/* viewport x-ray */
DRW_shgroup_uniform_int(grp, "viewport_xray", &stl->storage->is_xray, 1);
-
- stl->shgroups[id].shading_type[0] = (int)OB_RENDER;
- DRW_shgroup_uniform_int(grp, "shading_type", &stl->shgroups[id].shading_type[0], 2);
+ DRW_shgroup_uniform_int(grp, "shading_type", (const int *)&stl->storage->shade_render, 2);
}
if ((gpd) && (id > -1)) {
@@ -1347,7 +1345,6 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data, void *vedata, T
bGPdata *gpd = (bGPdata *)DEG_get_original_id(&gpd_eval->id);
MaterialGPencilStyle *gp_style = NULL;
- const int shade_render[2] = { OB_RENDER, 0 };
float obscale = mat4_to_scale(ob->obmat);
/* use the brush material */
@@ -1375,12 +1372,12 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data, void *vedata, T
if ((gp_style) && (gp_style->mode == GP_STYLE_MODE_LINE)) {
stl->g_data->shgrps_drawing_stroke = DRW_gpencil_shgroup_stroke_create(
e_data, vedata, psl->drawing_pass, e_data->gpencil_stroke_sh, NULL,
- gpd, NULL, NULL, gp_style, -1, false, 1.0f, shade_render);
+ gpd, NULL, NULL, gp_style, -1, false, 1.0f, stl->storage->shade_render);
}
else {
stl->g_data->shgrps_drawing_stroke = DRW_gpencil_shgroup_point_create(
e_data, vedata, psl->drawing_pass, e_data->gpencil_point_sh, NULL,
- gpd, NULL, gp_style, -1, false, 1.0f, shade_render);
+ gpd, NULL, gp_style, -1, false, 1.0f, stl->storage->shade_render);
}
/* clean previous version of the batch */
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 2cbdb3bb918..97b81e3ba1f 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -248,6 +248,8 @@ void GPENCIL_engine_init(void *vedata)
/* unit matrix */
unit_m4(stl->storage->unit_matrix);
+ stl->storage->shade_render[0] = OB_RENDER;
+ stl->storage->shade_render[1] = 0;
}
stl->storage->multisamples = U.gpencil_multisamples;
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h
index c988033e722..fc45463fa1a 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -170,6 +170,7 @@ typedef struct GPENCIL_Storage {
float view_vecs[2][4]; /* vec4[2] */
float grid_matrix[4][4];
+ int shade_render[2];
Object *camera; /* camera pointer for render mode */
} GPENCIL_Storage;