diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-03-31 22:22:30 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-04-05 11:36:12 +0300 |
commit | a66116f5439fa5ebf33a27867e846006ac20f78d (patch) | |
tree | 69076815fa406ca5426a2e97242d7078f89b0732 | |
parent | b3f08cddf3ec69275d4ac9d843a1d96d8713f93d (diff) |
Fix T48012: Knife Project crash
-rw-r--r-- | source/blender/bmesh/intern/bmesh_polygon_edgenet.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/source/blender/bmesh/intern/bmesh_polygon_edgenet.c b/source/blender/bmesh/intern/bmesh_polygon_edgenet.c index 1ee96d4e759..e9d43ebd246 100644 --- a/source/blender/bmesh/intern/bmesh_polygon_edgenet.c +++ b/source/blender/bmesh/intern/bmesh_polygon_edgenet.c @@ -1485,12 +1485,26 @@ finally: #ifdef USE_PARTIAL_CONNECT /* don't free 'vert_temp_pair_list', its part of the arena */ if (use_partial_connect) { + + /* Sanity check: ensure we don't have connecting edges before splicing begins. */ +#ifdef DEBUG + { + struct TempVertPair *tvp = temp_vert_pairs.list; + do { + /* we must _never_ create connections here + * (inface the islands can't have a connection at all) */ + BLI_assert(BM_edge_exists(tvp->v_orig, tvp->v_temp) == NULL); + } while ((tvp = tvp->next)); + } +#endif + struct TempVertPair *tvp = temp_vert_pairs.list; do { - /* we must _never_ create connections here - * (inface the islands can't have a connection at all) */ - BLI_assert(BM_edge_exists(tvp->v_orig, tvp->v_temp) == NULL); - BM_vert_splice(bm, tvp->v_orig, tvp->v_temp); + /* its _very_ unlikely the edge exists, + * however splicing may case this. see: T48012 */ + if (!BM_edge_exists(tvp->v_orig, tvp->v_temp)) { + BM_vert_splice(bm, tvp->v_orig, tvp->v_temp); + } } while ((tvp = tvp->next)); /* Remove edges which have become doubles since splicing vertices together, |