Fix arrange crash with ASAN
This commit is contained in:
parent
7fe691f14e
commit
177a96a768
1 changed files with 8 additions and 2 deletions
|
@ -33,10 +33,16 @@ protected:
|
||||||
// then it should be removed from the list
|
// then it should be removed from the list
|
||||||
auto it = c.begin();
|
auto it = c.begin();
|
||||||
while (it != c.end() && !stopcond_()) {
|
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;
|
const Item& itm = *it;
|
||||||
Item cpy{itm};
|
Item cpy{itm};
|
||||||
|
|
||||||
|
Placer p{bin};
|
||||||
|
p.configure(pcfg);
|
||||||
if (!p.pack(cpy)) it = c.erase(it);
|
if (!p.pack(cpy)) it = c.erase(it);
|
||||||
else it++;
|
else it++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue