Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when undoing after layer deletion #1412

Closed
Kaikogf opened this issue Aug 5, 2020 · 4 comments · Fixed by #1486
Closed

Crash when undoing after layer deletion #1412

Kaikogf opened this issue Aug 5, 2020 · 4 comments · Fixed by #1486

Comments

@Kaikogf
Copy link

Kaikogf commented Aug 5, 2020

Issue Summary

I imported a new Movie Video and deleted its layer after that, and when I tried to UNDO it to have the layer back pencil2D closed without warning

Steps to reproduce

Remember not to click any where besides the steps mentioned here, otherwise the issue will not show
File > Import > Movie Video > (I selected a 850kb MP4 movie video with sound). After imported successfully, go to Layers and delete the bitmap layer (which contains the movie video), and then click UNDO

One Note:
When importing a Movie Video, it will not import its audio. Is this intentional?

System Information

  • Pencil2D Version:
    Last stable version v.0.6.5

  • Operating System:
    Windows 10

  • RAM Size:
    32GB

  • Graphics Tablet:
    HUION HD 185

@scribblemaniac
Copy link
Member

Undoing a layer deletion is not supported currently, regardless of what its contents are. What you are probably doing is attempting to undo the image import which crashes because the layer no longer exists. I thought there was an issue for this already but I can't seem to find it at the moment. I've been aware of it for a long time and it will be fixed with #953. This has nothing to do with the movie video import.

When importing a Movie Video, it will not import its audio. Is this intentional?

Yes. You must use the Movie Audio import separately to import the audio.

@scribblemaniac scribblemaniac changed the title [ISSUE] When Importing Movie Video Crash when undoing after layer deletion Aug 5, 2020
@scribblemaniac scribblemaniac added this to the 0.7 milestone Aug 5, 2020
@Kaikogf
Copy link
Author

Kaikogf commented Aug 6, 2020

Hi @scribblemaniac

What you are probably doing is attempting to undo the image import which crashes because the layer no longer exists.

No. I imported a movie video to the default layer (it played OK on the timeline) and after that I deleted that specific layer and tried to undo it, which crashed pencil2d 👍

EDITED:
I think you are right. Your text makes me think 👍

@scribblemaniac
Copy link
Member

Think of it this way. There is a stack with all the undoable actions. When you start a new file it is empty. When you import a movie, it adds many actions to the stack. If for instance the video is a total of 4 frames in length, the stack would look like this:

  1. Insert image on Frame 1 of Layer 1
  2. Insert image on Frame 2 of Layer 1
  3. Insert image on Frame 3 of Layer 1
  4. Insert image on Frame 4 of Layer 1

Now you delete a layer. Since deleting a layer is not an undoable action, it is not added to the stack. Now you hit the undo action. It finds the last undoable action, which in this case is "Insert image of Frame 4 of Layer 1", and attempts to undo it. It does this by reverting Frame 4 on Layer 1 to what it was before the image was added. However, Layer 1 no longer exists, so it doesn't know how to modify that frame and it crashes.

The same bug can be reproduced by drawing something on the bitmap layer (rather than using the movie import), deleting it, and then undoing.

@Kaikogf
Copy link
Author

Kaikogf commented Aug 8, 2020

@scribblemaniac
Well explained ... That crossed my mind 👍

@scribblemaniac scribblemaniac mentioned this issue Oct 9, 2020
@J5lx J5lx added the Crash label Oct 23, 2020
@Jose-Moreno Jose-Moreno linked a pull request Oct 24, 2020 that will close this issue
@J5lx J5lx closed this as completed in 97c79ad Oct 24, 2020
@MrStevns MrStevns modified the milestones: 0.7.0, v0.6.7 Jul 5, 2023
@J5lx J5lx moved this to Closed in Bug Fix Priority Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

4 participants