slic3r: address sanitizer cleanup in TreeSupport::generate_contact_points
In generate_contact_points, the rotated_dims don't actually generate a Point, but generate an abstract expression that holds a reference to bounding_box_size. Unfortunately, this goes wrong because bounding_box_size ages out instantly; GCC's Address Sanitizer complains that this is a "stack-use-after-scope" issue. Interestingly, the Eigen documentation says that this is a known problem with using C++11 "auto" to generate matrices (which a Point is)! It is buried here: https://eigen.tuxfamily.org/dox/TopicPitfalls.html This is probably an extremely theoretical correctness improvement, and also an extremely theoretical performance improvement. But it is an improvement nonetheless, and, more importantly, it enables me to continue to run the slicer with Address Sanitizer turned on to find other potential issues.
This commit is contained in:
parent
ab64ae8c63
commit
040af5fa98
|
@ -3330,7 +3330,7 @@ void TreeSupport::generate_contact_points(std::vector<std::vector<TreeSupport::N
|
||||||
const auto center = bounding_box_middle(bounding_box);
|
const auto center = bounding_box_middle(bounding_box);
|
||||||
const auto sin_angle = std::sin(rotate_angle);
|
const auto sin_angle = std::sin(rotate_angle);
|
||||||
const auto cos_angle = std::cos(rotate_angle);
|
const auto cos_angle = std::cos(rotate_angle);
|
||||||
const auto rotated_dims = Point(
|
const Point rotated_dims = Point(
|
||||||
bounding_box_size(0) * cos_angle + bounding_box_size(1) * sin_angle,
|
bounding_box_size(0) * cos_angle + bounding_box_size(1) * sin_angle,
|
||||||
bounding_box_size(0) * sin_angle + bounding_box_size(1) * cos_angle) / 2;
|
bounding_box_size(0) * sin_angle + bounding_box_size(1) * cos_angle) / 2;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue