[Consider merging] fixed a potential race condition with invalid Shapes container after clear

This commit is contained in:
Matthias Koefferlein 2022-07-31 00:10:36 +02:00
parent 43101ded7f
commit 3c5ca36081
1 changed files with 2 additions and 1 deletions

View File

@ -998,6 +998,8 @@ Shapes::clear ()
{
if (!m_layers.empty ()) {
invalidate_state (); // HINT: must come before the change is done!
for (tl::vector<LayerBase *>::const_iterator l = m_layers.end (); l != m_layers.begin (); ) {
// because the undo stack will do a push, we need to remove layers from the back (this is the last undo
// element to be executed)
@ -1010,7 +1012,6 @@ Shapes::clear ()
}
}
invalidate_state (); // HINT: must come before the change is done!
m_layers.clear ();
}