After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 656292 - list index out of range, when saving after an undo
list index out of range, when saving after an undo
Status: RESOLVED FIXED
Product: meld
Classification: Other
Component: general
1.5.x
Other Linux
: Normal normal
: ---
Assigned To: meld-maint
meld-maint
: 651651 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-08-10 15:30 UTC by Julian Taylor
Modified: 2011-08-13 21:09 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Julian Taylor 2011-08-10 15:30:32 UTC
with current git head f8ec49175f4767

open attached files:
meld left right
copy dh_python2 from right to left
save
undo (ctrl z)
save
=> crash:

Traceback (most recent call last):
  • File "/home/jtaylor/tmp/meld/meld/meldwindow.py", line 378 in on_menu_save_activate
    self.current_doc().save()
  • File "/home/jtaylor/tmp/meld/meld/filediff.py", line 1381 in save
    self.save_file(pane)
  • File "/home/jtaylor/tmp/meld/meld/filediff.py", line 1359 in save_file
    self.undosequence.checkpoint(buf)
  • File "/home/jtaylor/tmp/meld/meld/undo.py", line 182 in checkpoint
    while end < len(self.actions) and self.actions[end + 1].buffer != buf:
IndexError: list index out of range


debugger run:
> /home/jtaylor/tmp/meld/meld/undo.py(182)checkpoint()
    181         end = self.next_redo
--> 182         while end < len(self.actions) and self.actions[end + 1].buffer != buf:
    183             end += 1

ipdb> p self.actions
[<meld.undo.GroupAction object at 0x319e9d0>]
ipdb> p len(self.actions)
1
ipdb> p end
0

fixes seems simple:
-        while end < len(self.actions) and self.actions[end + 1].buffer != buf:
+        while end < (len(self.actions) - 1) and self.actions[end + 1].buffer != buf:
Comment 1 Kai Willadsen 2011-08-13 20:50:50 UTC
I was about to get really excited to have an easy repro for this... and then I noticed that you hadn't attached the files. Any chance that you'd be able to do so?

Having said that, the fix looks reasonable. I'd just prefer to have a test case.
Comment 2 Kai Willadsen 2011-08-13 20:53:41 UTC
Nevermind. The important sequence is: modify; save; undo; save. Sorry for the noise.
Comment 3 Kai Willadsen 2011-08-13 21:09:54 UTC
Fixed in HEAD. Thanks for the patch.
Comment 4 Kai Willadsen 2011-08-13 21:09:58 UTC
*** Bug 651651 has been marked as a duplicate of this bug. ***