[Bf-blender-cvs] [d2c76b4a237] gpencil-new-data-proposal: Fix: Using MEM_freeN on a non-trivial struct/class
Hans Goudey
noreply at git.blender.org
Mon Dec 12 20:35:48 CET 2022
Commit: d2c76b4a23734189df4acd9f7cef819bb71e335a
Author: Hans Goudey
Date: Mon Dec 12 13:35:42 2022 -0600
Branches: gpencil-new-data-proposal
https://developer.blender.org/rBd2c76b4a23734189df4acd9f7cef819bb71e335a
Fix: Using MEM_freeN on a non-trivial struct/class
===================================================================
M source/blender/blenkernel/intern/gpencil_new_proposal.cc
===================================================================
diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal.cc b/source/blender/blenkernel/intern/gpencil_new_proposal.cc
index 5f91d050f6b..92be1059619 100644
--- a/source/blender/blenkernel/intern/gpencil_new_proposal.cc
+++ b/source/blender/blenkernel/intern/gpencil_new_proposal.cc
@@ -89,7 +89,7 @@ GPFrame::GPFrame(const GPFrame &other) : GPFrame(other.layer_index)
{
if (other.strokes != nullptr) {
/* Make sure old strokes are freed before copying. */
- MEM_SAFE_FREE(this->strokes);
+ MEM_delete(reinterpret_cast<CurvesGeometry *>(this->strokes));
this->strokes = MEM_new<CurvesGeometry>(__func__);
*reinterpret_cast<CurvesGeometry *>(this->strokes) = CurvesGeometry::wrap(*other.strokes);
@@ -102,7 +102,7 @@ GPFrame &GPFrame::operator=(const GPFrame &other)
{
if (this != &other && other.strokes != nullptr) {
/* Make sure old strokes are freed before copying. */
- MEM_SAFE_FREE(this->strokes);
+ MEM_delete(reinterpret_cast<CurvesGeometry *>(this->strokes));
this->strokes = MEM_new<CurvesGeometry>(__func__);
*reinterpret_cast<CurvesGeometry *>(this->strokes) = CurvesGeometry::wrap(*other.strokes);
More information about the Bf-blender-cvs
mailing list