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); }