From 9ebb923d835a0c18cf3e481ea050f08059e62147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20K=C3=B6fferlein?= Date: Mon, 5 Sep 2022 20:31:13 +0200 Subject: [PATCH] Issue 1144 (#1150) * [CONSIDER MERGING] Clarification and typo fixed in DRC doc. * Avoids a segfault during drawing: make sure the cell bbox update is not triggered in the drawing thread before it is stopped * Fixed #1144 (wrong layer taken on copy layer) --- src/db/db/dbLayoutStateModel.cc | 8 ++++---- src/layui/layui/layWidgets.cc | 6 ++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/db/db/dbLayoutStateModel.cc b/src/db/db/dbLayoutStateModel.cc index 7a25be793..1118e34ef 100644 --- a/src/db/db/dbLayoutStateModel.cc +++ b/src/db/db/dbLayoutStateModel.cc @@ -78,11 +78,11 @@ LayoutStateModel::invalidate_bboxes (unsigned int index) m_all_bboxes_dirty = true; } } else { - if (index >= (unsigned int) m_bboxes_dirty.size ()) { - m_bboxes_dirty.resize (index + 1, false); - } - if ((! m_all_bboxes_dirty && ! m_bboxes_dirty [index]) || m_busy) { + if ((! m_all_bboxes_dirty && (index >= (unsigned int) m_bboxes_dirty.size () || ! m_bboxes_dirty [index])) || m_busy) { do_invalidate_bboxes (index); // must be called before the bboxes are invalidated (stopping of redraw thread requires this) + if (index >= (unsigned int) m_bboxes_dirty.size ()) { + m_bboxes_dirty.resize (index + 1, false); + } m_bboxes_dirty [index] = true; } } diff --git a/src/layui/layui/layWidgets.cc b/src/layui/layui/layWidgets.cc index 7f8207279..1878937b1 100644 --- a/src/layui/layui/layWidgets.cc +++ b/src/layui/layui/layWidgets.cc @@ -390,10 +390,8 @@ BEGIN_PROTECTED mp_private->view->manager ()->commit (); - insertItem (index, tl::to_qstring (lp.to_string ())); - setCurrentIndex (index); - - mp_private->layers.push_back (std::make_pair (lp, int (l))); + // NOTE: add_new_layers has triggered update_layer_list which already added the new layer + set_current_layer (lp); }