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 be nullptr. After they are created we try to set their EasingType, which of course will make a segmentation fault if they are nullptr, 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
1. Start the program
2. Select the Camera layer
3. Add a frame (playhead will move to frame 2nd)
4. Go to frame 1
5. Press the `Delete Frame` button
6. Press `Add Frame` button
7. 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: 91b1721baef012d49cffd0d23358524a420af9fd
date: 2021-11-14_16:46:59
Operating System: Windows 10 Version 2009
CPU Architecture: x86_64
Qt Version: 5.15.2
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: