Version:
Tested with version 8.32 alpha, windows x64 self compiled (master branch, date 2020-01-16, commit 2cd3298fde496b1632dac5cb7e9ff21d22e9bad3)
(present in stable release, possibly since rework of undo)
Bug description:
When going on last undo in undo history (assuming enough actions were done to start overwriting undo stack) going one step further (ctrl+z) makes Blender skip several actions back.
Replication:
Creating cube, subdividing and removing faces till the maximum capacity of undo stack is reached (and a bit more after).
After doing undo till possible. Last undo will be large skip of actions (mentioned bug)
Alternatively selecting last undo from undo history and then making one more undo with undo button (or ctrl+z)
PS: The easy way is to set undo steps to a minimum to faster reach overwriting of undo stack.
Possible cause:
This bug is caused by leaving at least one undo record with type 'BKE_UNDOSYS_TYPE_MEMFILE' (function BKE_undosys_stack_init_or_active_with_type(...), specifically code below line 435 in undo_system.c).
This kept undo record will often stay at the bottom of the stack and contains very old undo and thus skipping a lot of actions that were made (that can lead to accidental lose work).
Possible fix:
Ignore this always kept undo record when doing undo. (Not sure about inner working and might be bad fix):
(after line 670 in BKE_undosys_step_undo_with_data_ex(...) in undo_system.c)
inserting this snippet:
while (us != NULL && us->type->name == "Global Undo") {
us = us->prev;
}Referred files:
source/blender/blenkernel/intern/undo_system.c
