[Bf-blender-cvs] [c752884d0da] geometry-nodes-curve-support: Geometry Nodes Curves: Fix memory leak

Hans Goudey noreply at git.blender.org
Mon Apr 5 20:44:09 CEST 2021


Commit: c752884d0daa2d575b892c25ab30e30b73962194
Author: Hans Goudey
Date:   Mon Apr 5 13:43:58 2021 -0500
Branches: geometry-nodes-curve-support
https://developer.blender.org/rBc752884d0daa2d575b892c25ab30e30b73962194

Geometry Nodes Curves: Fix memory leak

===================================================================

M	source/blender/blenkernel/BKE_derived_curve.hh

===================================================================

diff --git a/source/blender/blenkernel/BKE_derived_curve.hh b/source/blender/blenkernel/BKE_derived_curve.hh
index bbfb305fe47..bc8f7bd80c3 100644
--- a/source/blender/blenkernel/BKE_derived_curve.hh
+++ b/source/blender/blenkernel/BKE_derived_curve.hh
@@ -56,6 +56,8 @@ class Spline {
   Type type;
   bool is_cyclic = false;
 
+  virtual ~Spline() = default;
+
   virtual int size() const = 0;
   virtual int resolution() const = 0;
   virtual void set_resolution(const int value) = 0;
@@ -190,6 +192,13 @@ struct DCurve {
   //   AttributeStorage attributes;
   //   CustomData *control_point_data;
   //   CustomData *spline_data;
+
+  ~DCurve()
+  {
+    for (Spline *spline : splines) {
+      delete spline;
+    }
+  }
 };
 
 DCurve *dcurve_from_dna_curve(const Curve &curve);
\ No newline at end of file



More information about the Bf-blender-cvs mailing list