Fix #135490: Incorrect allocation size with MEM_new (naming collisions)

Resolve naming collisions for structs which could cause the wrong size
to be used allocating the `LaplacianSystem` when calculating mesh
weights from an armature.

Ref !135491
This commit is contained in:
Campbell Barton
2025-03-05 14:23:32 +11:00
parent a4ac52d0d0
commit f54eeaf2aa
2 changed files with 10 additions and 0 deletions
@@ -49,6 +49,9 @@ enum {
LAPDEFORM_SYSTEM_CHANGE_NOT_VALID_GROUP,
};
/* Prevent naming collision. */
namespace {
struct LaplacianSystem {
bool is_matrix_computed;
bool has_solution;
@@ -87,6 +90,8 @@ struct LaplacianSystem {
MeshElemMap *ringv_map;
};
}; // namespace
static LaplacianSystem *newLaplacianSystem()
{
LaplacianSystem *sys = MEM_cnew<LaplacianSystem>(__func__);
@@ -31,6 +31,9 @@
#include "eigen_capi.h"
/* Prevent naming collision. */
namespace {
struct LaplacianSystem {
float *eweights = nullptr; /* Length weights per Edge */
float (*fweights)[3] = nullptr; /* Cotangent weights per face */
@@ -54,6 +57,8 @@ struct LaplacianSystem {
float vert_centroid[3] = {};
};
}; // namespace
static void delete_laplacian_system(LaplacianSystem *sys)
{
MEM_SAFE_FREE(sys->eweights);