diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-04-08 12:30:31 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-04-08 13:39:56 +0300 |
commit | 76cc8e8436875c1c700d6a7d29d3cffeddc04c7d (patch) | |
tree | 9c6cfc3484a7e61d60ff29da206570ae5af62788 /source/blender/editors/util | |
parent | ed2639c7223be65f39be78fd7cac4a7b1c395890 (diff) |
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
Diffstat (limited to 'source/blender/editors/util')
-rw-r--r-- | source/blender/editors/util/ed_util.c | 24 |
1 files changed, 3 insertions, 21 deletions
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); } } } |