Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Undo frame deletion double undo/crash #1557

@scribblemaniac

Description

@scribblemaniac

Issue Summary

Undoing a frame deletion can cause two actions to be undone, or a crash in some situations. This is likely the same issue as #843, although the steps to reproduce are more involved.

Steps to reproduce

  1. Create a new project.
  2. Create a layer with at least two keyframes.
  3. Delete the first keyframe. If you are using a bitmap layer, the first keyframe must be at a position > 1.
  4. Undo the frame deletion. This will undo the frame deletion and the action before that, or it will crash if no other undoable actions were performed.

System Information

  • Pencil2D Version: 6f0b75b, v0.6.5

  • Operating System: Ubuntu 20.04

  • RAM Size: 16 GB

  • Graphics Tablet: N/A

Developer Notes

This crash is happening when Editor::backup is called before reverting the deletion. In that function it uses getLast*ImageAtFrame, which returns null if there isn't a previous frame. If it's null, the backup is skipped, however Editor::undo always decrements mBackupIndex whether or not the backup was successful. Thus it goes back two actions instead of one, or causes an out of bounds exception if it goes below 0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions