From 5c432cd11bc457996d9752edf2bb0408c420176e Mon Sep 17 00:00:00 2001 From: Howard Trickey Date: Thu, 14 Feb 2019 17:21:50 -0500 Subject: [PATCH] Fix T61427: Bevel crash with patch miter. The adjustment phase had broken assumptions after adding miters, and sent a null problem to eigen. Fixed code to check assumptions. --- source/blender/bmesh/tools/bmesh_bevel.c | 12 +++++++++--- source/tools | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index 5d9963fd4c0..a530efd51d2 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -2816,10 +2816,11 @@ static void adjust_the_cycle_or_chain(BoundVert *vstart, bool iscycle) static void adjust_offsets(BevelParams *bp) { BevVert *bv, *bvcur; - BoundVert *v, *vanchor, *vchainstart, *vnext; + BoundVert *v, *vanchor, *vchainstart, *vchainend, *vnext; EdgeHalf *enext; GHashIterator giter; bool iscycle; + int chainlen; /* find and process chains and cycles of unvisited BoundVerts that have eon set */ GHASH_ITER(giter, bp->vert_hash) { @@ -2840,8 +2841,9 @@ static void adjust_offsets(BevelParams *bp) * pairs with the right side of the next edge in the cycle or chain. */ /* first follow paired edges in left->right direction */ - v = vchainstart = vanchor; + v = vchainstart = vchainend = vanchor; iscycle = false; + chainlen = 1; while (v->eon && !v->visited && !iscycle) { v->visited = true; if (!v->efirst) @@ -2852,6 +2854,8 @@ static void adjust_offsets(BevelParams *bp) BLI_assert(enext != NULL); vnext = enext->leftv; v->adjchain = vnext; + vchainend = vnext; + chainlen++; if (vnext->visited) { if (vnext != vchainstart) { break; @@ -2874,10 +2878,12 @@ static void adjust_offsets(BevelParams *bp) break; vnext = enext->rightv; vnext->adjchain = v; + chainlen++; vchainstart = vnext; v = vnext; } while (!v->visited && v->eon); - adjust_the_cycle_or_chain(vchainstart, false); + if (chainlen >= 3 && !vchainstart->eon && !vchainend->eon) + adjust_the_cycle_or_chain(vchainstart, false); } } while ((vanchor = vanchor->next) != bv->vmesh->boundstart); } diff --git a/source/tools b/source/tools index 83428cbf0a8..3f0d91e9249 160000 --- a/source/tools +++ b/source/tools @@ -1 +1 @@ -Subproject commit 83428cbf0a8d7e0bdd7a91c00124381c1db42e70 +Subproject commit 3f0d91e9249bf35b92ee745e2c45c460c869fb25