Global undo/redo now clears the local undo editmode stack entirely.

Error goes back to the 2.3 days, when undo was added.

Global undo refreshes the entire internal database, so all ID pointers get invalid.
This cases editmode undo storage to fail, if it uses ID pointers as well.

The error was that for any Mesh undo stack, a single global undo would make the
mesh stack corrupt. Back in edit mode, on undo you'd lose assigned texture images, 
or get bad crashes.

The downside is that people expect this to work... it's a fun feature to maintain
stacks separately. Having this instable is not acceptable though. Needs quite some
redesign work to solve it (like Dalai's kill-the-tface project :)
This commit is contained in:
Ton Roosendaal 2013-04-05 17:10:28 +00:00
parent 5e0cdd6473
commit b18a7c3cd6

@ -186,6 +186,11 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
//#ifdef WITH_PYTHON
// XXX BPY_scripts_clear_pyobjects();
//#endif
/* for global undo/redo we should just clear the editmode stack */
/* for example, texface stores image pointers */
undo_editmode_clear();
if (undoname)
BKE_undo_name(C, undoname);
else