Maniphest T73180

Last undo in undo history reverting multiple actions
Closed, ResolvedKNOWN ISSUE

Assigned To
None
Authored By
Dominik Kosík (Rengyr)
Jan 17 2020, 10:42 AM
Tags
  • BF Blender
  • Pipeline, Assets & I/O
  • Modeling
Subscribers
Bastien Montagne (mont29)
Campbell Barton (campbellbarton)
Dominik Kosík (Rengyr)
Germano Cavalcante (mano-wii)

Description

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

Related Objects

Mentioned Here
rB2cd3298fde49: Minor correction to previous commit

Event Timeline

Dominik Kosík (Rengyr) created this task.Jan 17 2020, 10:42 AM
Richard Antalik (ISS) changed the task status from Needs Triage to Confirmed.Jan 20 2020, 12:29 PM
Germano Cavalcante (mano-wii) added projects: Pipeline, Assets & I/O, Modeling.Jan 20 2020, 12:53 PM
Germano Cavalcante (mano-wii) added subscribers: Campbell Barton (campbellbarton), Germano Cavalcante (mano-wii).

I tried to reproduce the problem.
The cube ended up like this:

Blender skipped to the action of entering edit mode and skipped the first edits.
In fact, it kept (internally) one last undo of the type BKE_UNDOSYS_TYPE_MEMFILE.

I suppose it was expected to have stopped in edit mode.

@Campbell Barton (campbellbarton), is this somehow working as designed or is it a bug?

Bastien Montagne (mont29) added a subscriber: Bastien Montagne (mont29).Jan 20 2020, 9:08 PM
Bastien Montagne (mont29) moved this task from Backlog to Bugs on the Pipeline, Assets & I/O board.Feb 13 2020, 9:32 PM
Bastien Montagne (mont29) changed the subtype of this task from "Report" to "Known Issue".Feb 13 2020, 9:35 PM
Bastien Montagne (mont29) moved this task from Bugs to Known Issues on the Pipeline, Assets & I/O board.
Campbell Barton (campbellbarton) changed the task status from Duplicate to Resolved.Jun 18 2020, 11:13 AM
Campbell Barton (campbellbarton) closed this task as a duplicate of T76642: Confusing undo steps limit behavior.