Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortamasmeszaros <meszaros.q@gmail.com>2019-09-13 12:01:02 +0300
committertamasmeszaros <meszaros.q@gmail.com>2019-09-13 12:01:02 +0300
commit177a96a768b7fb9abd37b39d47b9a3a1c9e976af (patch)
tree84788423acb76b15df1805f408d2ea70e49af6c6 /src/libnest2d
parent7fe691f14efd1d89f3190b2fc12e5d907c0082d5 (diff)
Fix arrange crash with ASAN
Diffstat (limited to 'src/libnest2d')
-rw-r--r--src/libnest2d/include/libnest2d/selections/selection_boilerplate.hpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libnest2d/include/libnest2d/selections/selection_boilerplate.hpp b/src/libnest2d/include/libnest2d/selections/selection_boilerplate.hpp
index 4bb2e72af..2df9a26c3 100644
--- a/src/libnest2d/include/libnest2d/selections/selection_boilerplate.hpp
+++ b/src/libnest2d/include/libnest2d/selections/selection_boilerplate.hpp
@@ -33,10 +33,16 @@ protected:
// then it should be removed from the list
auto it = c.begin();
while (it != c.end() && !stopcond_()) {
- Placer p{bin};
- p.configure(pcfg);
+
+ // WARNING: The copy of itm needs to be created before Placer.
+ // Placer is working with references and its destructor still
+ // manipulates the item this is why the order of stack creation
+ // matters here.
const Item& itm = *it;
Item cpy{itm};
+
+ Placer p{bin};
+ p.configure(pcfg);
if (!p.pack(cpy)) it = c.erase(it);
else it++;
}