Page MenuHome

Fix T86293: crash undoing after executing the python console in certain scenarios
ClosedPublic

Authored by Philipp Oeser (lichtwerk) on Mar 5 2021, 11:26 AM.

Details

Summary

In general, I could not find a reason executing from the python console
should not do an Undo push. Running a script from the Text Editor does
this as well and this seems generally useful.

Without an Undo push, one can easily run into situations were IDs have
been added or removed and undo on would then cause trouble
(e.g. first selection then bpy.ops.object.duplicate() -- this crashed as reported in T86293 --
'duplicate' does not get its own undo push because it is not the last op in the list, wm->op_undo_depth is not zero).
This has changed with the Undo refactor, so in essence the root cause is the same as T77557, Legacy Undo does not suffer from the crash (but misses
the generally useful undo push from the console still)

Now add Undo to CONSOLE_OT_execute bl_options ('UNDO_GROUPED' seems more
appropriate than plain 'UNDO' since pasting multiple lines of code will
call CONSOLE_OT_execute multiple times in a row).

Diff Detail

Repository
rB Blender
Branch
T86293 (branched from master)
Build Status
Buildable 13274
Build 13274: arc lint + arc unit

Event Timeline

Philipp Oeser (lichtwerk) requested review of this revision.Mar 5 2021, 11:26 AM
Philipp Oeser (lichtwerk) created this revision.

Adding Core tag since it touches UNDO.

While this will likely give some overhead on heavy scenes, I don't think there are better alternatives.

This revision is now accepted and ready to land.Mar 5 2021, 12:32 PM