diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-07-25 14:30:08 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-07-25 14:30:08 +0300 |
commit | a8d058dbf42f7ade5edf73425a0064cb1f4cd148 (patch) | |
tree | 58a90e0930191563c3d8f8afd094c3f1901473fb /source | |
parent | 4ca8f25fa86d770ff0fc237f57cfe58db35952eb (diff) |
Fix T79260: Crash displaying the same mesh in two windows
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_mesh.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index 410d59b557b..7cc10bd14e8 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -95,6 +95,11 @@ BLI_INLINE void mesh_cd_layers_type_clear(DRW_MeshCDMask *a) *((uint64_t *)a) = 0; } +BLI_INLINE const Mesh *editmesh_final_or_this(const Mesh *me) +{ + return (me->edit_mesh && me->edit_mesh->mesh_eval_final) ? me->edit_mesh->mesh_eval_final : me; +} + static void mesh_cd_calc_edit_uv_layer(const Mesh *UNUSED(me), DRW_MeshCDMask *cd_used) { cd_used->edit_uv = 1; @@ -132,7 +137,7 @@ BLI_INLINE const CustomData *mesh_cd_vdata_get_from_mesh(const Mesh *me) static void mesh_cd_calc_active_uv_layer(const Mesh *me, DRW_MeshCDMask *cd_used) { - const Mesh *me_final = (me->edit_mesh) ? me->edit_mesh->mesh_eval_final : me; + const Mesh *me_final = editmesh_final_or_this(me); const CustomData *cd_ldata = mesh_cd_ldata_get_from_mesh(me_final); int layer = CustomData_get_active_layer(cd_ldata, CD_MLOOPUV); if (layer != -1) { @@ -142,7 +147,7 @@ static void mesh_cd_calc_active_uv_layer(const Mesh *me, DRW_MeshCDMask *cd_used static void mesh_cd_calc_active_mask_uv_layer(const Mesh *me, DRW_MeshCDMask *cd_used) { - const Mesh *me_final = (me->edit_mesh) ? me->edit_mesh->mesh_eval_final : me; + const Mesh *me_final = editmesh_final_or_this(me); const CustomData *cd_ldata = mesh_cd_ldata_get_from_mesh(me_final); int layer = CustomData_get_stencil_layer(cd_ldata, CD_MLOOPUV); if (layer != -1) { @@ -152,7 +157,7 @@ static void mesh_cd_calc_active_mask_uv_layer(const Mesh *me, DRW_MeshCDMask *cd static void mesh_cd_calc_active_vcol_layer(const Mesh *me, DRW_MeshCDMask *cd_used) { - const Mesh *me_final = (me->edit_mesh) ? me->edit_mesh->mesh_eval_final : me; + const Mesh *me_final = editmesh_final_or_this(me); const CustomData *cd_vdata = mesh_cd_vdata_get_from_mesh(me_final); int layer = CustomData_get_active_layer(cd_vdata, CD_PROP_COLOR); @@ -163,7 +168,7 @@ static void mesh_cd_calc_active_vcol_layer(const Mesh *me, DRW_MeshCDMask *cd_us static void mesh_cd_calc_active_mloopcol_layer(const Mesh *me, DRW_MeshCDMask *cd_used) { - const Mesh *me_final = (me->edit_mesh) ? me->edit_mesh->mesh_eval_final : me; + const Mesh *me_final = editmesh_final_or_this(me); const CustomData *cd_ldata = &me_final->ldata; int layer = CustomData_get_active_layer(cd_ldata, CD_MLOOPCOL); @@ -176,7 +181,7 @@ static DRW_MeshCDMask mesh_cd_calc_used_gpu_layers(const Mesh *me, struct GPUMaterial **gpumat_array, int gpumat_array_len) { - const Mesh *me_final = (me->edit_mesh) ? me->edit_mesh->mesh_eval_final : me; + const Mesh *me_final = editmesh_final_or_this(me); const CustomData *cd_ldata = mesh_cd_ldata_get_from_mesh(me_final); const CustomData *cd_vdata = mesh_cd_vdata_get_from_mesh(me_final); |