[Bf-blender-cvs] [ccae00c9e23] master: Fix: memory leak in curve circle primitive node
Jacques Lucke
noreply at git.blender.org
Mon Dec 5 15:35:33 CET 2022
Commit: ccae00c9e239a70ff8cbac048520c815934ff8ca
Author: Jacques Lucke
Date: Mon Dec 5 15:34:54 2022 +0100
Branches: master
https://developer.blender.org/rBccae00c9e239a70ff8cbac048520c815934ff8ca
Fix: memory leak in curve circle primitive node
===================================================================
M source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc
===================================================================
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc
index 75f2116b237..7eff4923138 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc
@@ -109,12 +109,6 @@ static Curves *create_point_circle_curve(
return nullptr;
}
- Curves *curves_id = bke::curves_new_nomain_single(resolution, CURVE_TYPE_POLY);
- bke::CurvesGeometry &curves = bke::CurvesGeometry::wrap(curves_id->geometry);
- curves.cyclic_for_write().first() = true;
-
- MutableSpan<float3> positions = curves.positions_for_write();
-
float3 center;
/* Midpoints of `P1->P2` and `P2->P3`. */
const float3 q1 = math::interpolate(p1, p2, 0.5f);
@@ -142,6 +136,12 @@ static Curves *create_point_circle_curve(
return nullptr;
}
+ Curves *curves_id = bke::curves_new_nomain_single(resolution, CURVE_TYPE_POLY);
+ bke::CurvesGeometry &curves = bke::CurvesGeometry::wrap(curves_id->geometry);
+ curves.cyclic_for_write().first() = true;
+
+ MutableSpan<float3> positions = curves.positions_for_write();
+
/* Get the radius from the center-point to p1. */
const float r = math::distance(p1, center);
const float theta_step = ((2 * M_PI) / float(resolution));
More information about the Bf-blender-cvs
mailing list