From 3c5ca36081e672d3d8f3cdaf494317a511ab0317 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 31 Jul 2022 00:10:36 +0200 Subject: [PATCH] [Consider merging] fixed a potential race condition with invalid Shapes container after clear --- src/db/db/dbShapes.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/db/db/dbShapes.cc b/src/db/db/dbShapes.cc index 250918349..962234ee1 100644 --- a/src/db/db/dbShapes.cc +++ b/src/db/db/dbShapes.cc @@ -998,6 +998,8 @@ Shapes::clear () { if (!m_layers.empty ()) { + invalidate_state (); // HINT: must come before the change is done! + for (tl::vector::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 (); }