Check for deletion before moving vert in dyntopo collapse edge
authorNicholas Bishop <nicholasbishop@gmail.com>
Sat, 26 Jan 2013 17:19:21 +0000 (17:19 +0000)
committerNicholas Bishop <nicholasbishop@gmail.com>
Sat, 26 Jan 2013 17:19:21 +0000 (17:19 +0000)
Fixes [#33964] Dyntopo crash with edge collapse + undo
projects.blender.org/tracker/?func=detail&aid=33964&group_id=9&atid=498

source/blender/blenkernel/intern/pbvh_bmesh.c

index c464de64c6a28baf50f3bc33be8c1da5b18fceb2..9a0b1a769881ad981f2e70ea86b6d579ddc86885 100644 (file)
@@ -857,9 +857,12 @@ static void pbvh_bmesh_collapse_edge(PBVH *bvh, BMEdge *e, BMVert *v1,
                }
        }
 
-       /* Move v1 to the midpoint of v1 and v2 */
-       BM_log_vert_before_modified(bvh->bm, bvh->bm_log, v1);
-       mid_v3_v3v3(v1->co, v1->co, v2->co);
+       /* Move v1 to the midpoint of v1 and v2 (if v1 still exists, it
+        * may have been deleted above) */
+       if (!BLI_ghash_haskey(deleted_verts, v1)) {
+               BM_log_vert_before_modified(bvh->bm, bvh->bm_log, v1);
+               mid_v3_v3v3(v1->co, v1->co, v2->co);
+       }
 
        /* Delete v2 */
        BLI_assert(BM_vert_face_count(v2) == 0);