From f55ddbb1e3a77af9fb1c58e1098b1ba6c76129c9 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Mon, 26 Nov 2018 15:57:58 +0100 Subject: [PATCH] Fixed an libligl AABB assignment operator: memory aligned structures shall not be passed as "by value" parameters. This is explicitely warned against in the Eigen manual: https://eigen.tuxfamily.org/dox/group__TopicPassingByValue.html --- src/igl/AABB.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/igl/AABB.h b/src/igl/AABB.h index 891481aa0..69bc60c2e 100644 --- a/src/igl/AABB.h +++ b/src/igl/AABB.h @@ -68,10 +68,13 @@ public: //swap(first.m_low_sqr_d,second.m_low_sqr_d); //swap(first.m_depth,second.m_depth); } - // Pass-by-value (aka copy) - AABB& operator=(AABB other) + AABB& operator=(const AABB &other) { - swap(*this,other); + this->deinit(); + m_left = other.m_left ? new AABB(*other.m_left) : NULL; + m_right = other.m_right ? new AABB(*other.m_right) : NULL; + m_box = other.m_box; + m_primitive = other.m_primitive; return *this; } AABB(AABB&& other):