diff --git a/src/db/db/dbCell.cc b/src/db/db/dbCell.cc index 83acc1182..bda9d71f8 100644 --- a/src/db/db/dbCell.cc +++ b/src/db/db/dbCell.cc @@ -92,7 +92,8 @@ Cell::box_type Cell::ms_empty_box = Cell::box_type (); Cell::Cell (cell_index_type ci, db::Layout &l) : db::Object (l.manager ()), - m_cell_index (ci), mp_layout (&l), m_instances (this), m_prop_id (0), m_hier_levels (0), m_bbox_needs_update (false), m_ghost_cell (false), + m_cell_index (ci), mp_layout (&l), m_instances (this), m_prop_id (0), m_hier_levels (0), + m_instances_need_sort (false), m_instances_need_sort_box_tree (false), m_bbox_needs_update (false), m_ghost_cell (false), mp_last (0), mp_next (0) { // .. nothing yet @@ -131,6 +132,10 @@ Cell::operator= (const Cell &d) m_prop_id = d.m_prop_id; m_bbox_needs_update = d.m_bbox_needs_update; + // need to update the instances inst_by_cell_index pointers + m_instances_need_sort = true; + m_instances_need_sort_box_tree = true; + } return *this; } @@ -613,6 +618,8 @@ Cell::invalidate_insts () { mp_layout->invalidate_hier (); // HINT: must come before the change is done! mp_layout->invalidate_bboxes (std::numeric_limits::max ()); + m_instances_need_sort = true; + m_instances_need_sort_box_tree = true; m_bbox_needs_update = true; } @@ -700,7 +707,10 @@ Cell::clear_parent_insts (size_t sz) void Cell::sort_child_insts () { - m_instances.sort_child_insts (); + if (m_instances_need_sort) { + m_instances.sort_child_insts (); + } + m_instances_need_sort = false; } std::pair @@ -744,9 +754,12 @@ Cell::change_pcell_parameters (const instance_type &ref, const std::vector layers) { layers = cp.layers ();