Opened 7 years ago

Closed 7 years ago

#1161 closed defect (fixed)

undo traceback

Reported by: Greg Couch Owned by: Conrad Huang
Priority: blocker Milestone:
Component: Undo/Redo Version:
Keywords: Cc: Tom Goddard
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

Reproduce with:

open 1gcn
show
split atoms :1-12 atoms :13-24
undo

The traceback is:

Traceback (most recent call last):
  File "/home/chimera/chimerax_daily/lib/python3.6/site-packages/chimerax/core/undo.py", line 149, in undo
    inst.undo()
  File "/home/chimera/chimerax_daily/lib/python3.6/site-packages/chimerax/core/undo.py", line 342, in undo
    self._consistency_check()
  File "/home/chimera/chimerax_daily/lib/python3.6/site-packages/chimerax/core/undo.py", line 369, in _consistency_check
    (owner_length, value_length))
ValueError: undo action with different number of owners and old values: 0 != 246

Discussion:

Putting the logic in the split command to clear the undo stack would work, but there are probably lots of unknown places where that would need to be done. Instead, this should be a "UserError" -- ideally with the word 'atoms' instead of 'owners'.

Change History (7)

comment:1 by Conrad Huang, 7 years ago

The whole design of undo is that the mechanism doesn't care what types of items are being added. In this case, it's "atoms". In other cases, it may be "residues" or "molecules" or something else (surfaces, volumes?). A generic message like "Undo failed, probably because structures have been modified." might be okay?

comment:2 by Greg Couch, 7 years ago

Fine by me.

comment:3 by Conrad Huang, 7 years ago

Obviously the bad undo action should be popped off the stack. Should the entire undo stack be cleared?

comment:4 by Eric Pettersen, 7 years ago

Component: UnassignedUndo/Redo

comment:5 by Greg Couch, 7 years ago

Since the undo actions are not classified, eg., camera actions vs. structure actions, it is not possible to tell which previous actions are still valid, so clearing the undo stack is the reasonable thing to do. That should be part of the message: "Undo failed, .... Clearing undo stack"

in reply to:  6 ; comment:6 by goddard@…, 7 years ago

I think it is not necessary to clear the undo stack.  Possibly other actions that can be undone will work.  Why prevent the user from trying?  Of course failed undo actions need to give a sane user error rather than a traceback.

comment:7 by Conrad Huang, 7 years ago

Resolution: fixed
Status: assignedclosed

Fixed in 81635c182.

UserError exception is thrown now, resulting in an error message, not a traceback. Only the offending undo action is removed, leaving the remainder of the stack alone. Users can find out what's there via "undo list".

Note: See TracTickets for help on using tickets.