Fix: GPv3: Memory leaks from Grease Pencil undo steps

The `StepObject` stores customdata but relies on C++ object destruction.
CustomData is a C struct and doesn't get freed automatically, the
StepObject needs a destructor that takes care of the owned custom data.

Pull Request: https://projects.blender.org/blender/blender/pulls/119125
This commit is contained in:
Lukas Tönne
2024-03-06 15:42:25 +01:00
parent d88686fb2b
commit 8c2cf0f218
@@ -290,6 +290,11 @@ class StepObject {
}
public:
~StepObject()
{
CustomData_free(&layers_data_, layers_num_);
}
void encode(Object *ob, StepEncodeStatus &encode_status)
{
const GreasePencil &grease_pencil = *static_cast<GreasePencil *>(ob->data);