fix [#30699] blender crashes when dissolving faces
authorCampbell Barton <ideasman42@gmail.com>
Wed, 28 Mar 2012 06:44:19 +0000 (06:44 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 28 Mar 2012 06:44:19 +0000 (06:44 +0000)
thanks to Francisco De La Cruz for investigating and providing fix.

source/blender/editors/mesh/editmesh_utils.c

index 3958a28f4417f0410ac0c9802d777513780dafbf..e5a9cb98377bf1aeb7b668d79bd753584309f5e4 100644 (file)
@@ -146,7 +146,9 @@ int EDBM_op_finish(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const int r
        if (BMO_error_get(em->bm, &errmsg, NULL)) {
                BMEditMesh *emcopy = em->emcopy;
 
-               if (report) BKE_report(op->reports, RPT_ERROR, errmsg);
+               if (report) {
+                       BKE_report(op->reports, RPT_ERROR, errmsg);
+               }
 
                BMEdit_Free(em);
                *em = *emcopy;
@@ -154,7 +156,14 @@ int EDBM_op_finish(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const int r
                MEM_freeN(emcopy);
                em->emcopyusers = 0;
                em->emcopy = NULL;
-               return 0;
+
+               /* when copying, tessellation isn't to for faster copying,
+                * but means we need to re-tessellate here */
+               if (em->looptris == NULL) {
+                       BMEdit_RecalcTessellation(em);
+               }
+
+               return FALSE;
        }
        else {
                em->emcopyusers--;
@@ -167,9 +176,9 @@ int EDBM_op_finish(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const int r
                        MEM_freeN(em->emcopy);
                        em->emcopy = NULL;
                }
-       }
 
-       return 1;
+               return TRUE;
+       }
 }
 
 int EDBM_op_callf(BMEditMesh *em, wmOperator *op, const char *fmt, ...)