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
This commit is contained in:
parent
ed2639c722
commit
76cc8e8436
Notes:
blender-bot
2023-06-26 11:58:59 +02:00
Referenced by issue #85974, Edit-mode undo/redo causes assertion
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue