[Bf-blender-cvs] [76cc8e84368] master: Fix T85974: Edit-mode undo/redo causes assertion

Campbell Barton noreply at git.blender.org
Thu Apr 8 12:40:51 CEST 2021


Commit: 76cc8e8436875c1c700d6a7d29d3cffeddc04c7d
Author: Campbell Barton
Date:   Thu Apr 8 19:30:31 2021 +1000
Branches: master
https://developer.blender.org/rB76cc8e8436875c1c700d6a7d29d3cffeddc04c7d

Fix T85974: Edit-mode undo/redo causes assertion

Without legacy-undo, loading memfile undo only cleared edit-mode data
for mesh and armature object types.
This causes an assertion when loading edit-mode undo steps afterwards
for other object types as the existence of this data made entering
object mode fail.

Resolve this by freeing all objects types undo data from ED_editors_exit

===================================================================

M	source/blender/editors/util/ed_util.c

===================================================================

diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index da94eef4917..b80782b51be 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -27,9 +27,6 @@
 
 #include "MEM_guardedalloc.h"
 
-#include "DNA_armature_types.h"
-#include "DNA_mesh_types.h"
-
 #include "BLI_listbase.h"
 #include "BLI_path_util.h"
 #include "BLI_string.h"
@@ -206,24 +203,9 @@ void ED_editors_exit(Main *bmain, bool do_undo_system)
    *
    * To reproduce the problem where stale data is used, see: T84920. */
   for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
-    if (ob->type == OB_MESH) {
-      Mesh *me = ob->data;
-      if (me->edit_mesh) {
-        EDBM_mesh_free(me->edit_mesh);
-        MEM_freeN(me->edit_mesh);
-        me->edit_mesh = NULL;
-        if (do_undo_system == false) {
-          DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
-        }
-      }
-    }
-    else if (ob->type == OB_ARMATURE) {
-      bArmature *arm = ob->data;
-      if (arm->edbo) {
-        ED_armature_edit_free(ob->data);
-        if (do_undo_system == false) {
-          DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
-        }
+    if (ED_object_editmode_free_ex(bmain, ob)) {
+      if (do_undo_system == false) {
+        DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
       }
     }
   }



More information about the Bf-blender-cvs mailing list