From db1ab7b1505b630878e527a03b3b3e0b77f590fc Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 11 Jul 2014 19:52:43 +0200 Subject: Fix potential bug in loop normals code. Even if we cannot use computed lnor, we still have to empty the fan stack of lnors! --- source/blender/blenkernel/intern/mesh_evaluate.c | 4 ++++ source/blender/bmesh/intern/bmesh_mesh.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c index 7e547ec4c25..a9462aefa25 100644 --- a/source/blender/blenkernel/intern/mesh_evaluate.c +++ b/source/blender/blenkernel/intern/mesh_evaluate.c @@ -567,6 +567,10 @@ void BKE_mesh_normals_loop_split(MVert *mverts, const int UNUSED(numVerts), MEdg copy_v3_v3(nor, lnor); } } + else { + /* We still have to clear the stack! */ + while (BLI_SMALLSTACK_POP(normal)); + } } ml_prev = ml_curr; diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index e66d1263578..c996a5bb6a8 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -641,6 +641,10 @@ static void bm_mesh_loops_calc_normals(BMesh *bm, const float (*vcos)[3], const copy_v3_v3(nor, lnor); } } + else { + /* We still have to clear the stack! */ + while (BLI_SMALLSTACK_POP(normal)); + } } } while ((l_curr = l_curr->next) != l_first); } -- cgit v1.2.3