-
Notifications
You must be signed in to change notification settings - Fork 293
Description
Issue Summary
As reported by @davidlamhauge in discord, there's an issue where adding and deleting frames will cause the software to crash 100%
According to David this is related to how the interpolation between two frames is handled. I'll quote his comment from the server.
David Says:
I found a bug in the master branch, If you start the program, choose the Camera layer, add a frame, go to frame 1, press Delete Frame and then press Add Frame, the program crashes.
I've looked into it, with fresh eyes, and found out that the problem is in layercamera.cpp in the function
linearInterpolateTransform(Camera* cam).
To make the interpolation we create camera1 and camera2, which both can benullptr. After they are created we try to set their EasingType, which of course will make a segmentation fault if they arenullptr, and the program crashes.
This code works:
int frameNumber = cam->pos();
Camera* camera1 = static_cast<Camera*>(getLastKeyFrameAtPosition(frameNumber - 1));
if (camera1 != nullptr)
camera1->setEasingType(camera1->getEasingType());
int nextFrame = getNextKeyFramePosition(frameNumber);
Camera* camera2 = static_cast<Camera*>(getLastKeyFrameAtPosition(nextFrame));
if (camera2 != nullptr)
camera2->setEasingType(camera2->getEasingType());Note: The Highlights are mine
Expected Results
Pencil2D should not crash by adding or removing frames. Since this seems to be related to a null pointer exception, the source code should also not lead to them (obviously)
Steps to reproduce
- Start the program
- Select the Camera layer
- Add a frame (playhead will move to frame 2nd)
- Go to frame 1
- Press the
Delete Framebutton - Press
Add Framebutton - The program crashes.
System Information
Tested on the latest Nightly. David tested it on master as well.
- Pencil2D Version:
Nightly Build Nov 14 2021
commit: 91b1721
date: 2021-11-14_16:46:59
Operating System: Windows 10 Version 2009
CPU Architecture: x86_64
Qt Version: 5.15.2
Metadata
Metadata
Assignees
Type
Projects
Status