From b866ac63d3642281d5b1266a550190d4284a93a4 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 4 Apr 2026 00:20:37 +0200 Subject: [PATCH] Do not allow converting children of proxy cells to static Proxies and their tree below should not be manipulated, hence this operation is not allowed. --- src/layui/layui/layLayoutViewFunctions.cc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/layui/layui/layLayoutViewFunctions.cc b/src/layui/layui/layLayoutViewFunctions.cc index 938bc56b4..f965ed152 100644 --- a/src/layui/layui/layLayoutViewFunctions.cc +++ b/src/layui/layui/layLayoutViewFunctions.cc @@ -601,6 +601,27 @@ LayoutViewFunctions::cm_cell_convert_to_static () db::Layout &layout = view ()->cellview (cv_index)->layout (); + // check that all (unselected) parents are static cells - must not convert children + // of proxy cells. + + std::set to_convert; + for (std::vector::iterator p = paths.begin (); p != paths.end (); ++p) { + if (! p->empty () && layout.is_valid_cell_index (p->back ())) { + to_convert.insert (p->back ()); + } + } + + for (auto c = to_convert.begin (); c != to_convert.end (); ++c) { + std::set callers; + layout.cell (*c).collect_caller_cells (callers); + for (auto cc = callers.begin (); cc != callers.end (); ++cc) { + if (layout.cell (*cc).is_proxy () && to_convert.find (*cc) == to_convert.end ()) { + throw tl::Exception (tl::sprintf (tl::to_string (tr ("Cannot convert cells to static cells if they have library or PCell parents - here: %s as child of %s")), + layout.cell (*c).get_display_name (), layout.cell (*cc).get_display_name ())); + } + } + } + // remember the current path lay::LayoutViewBase::cell_path_type cell_path (view ()->cellview (cv_index).combined_unspecific_path ()); @@ -610,6 +631,8 @@ LayoutViewFunctions::cm_cell_convert_to_static () std::map cell_map; + // perform the conversion + for (std::vector::iterator p = paths.begin (); p != paths.end (); ++p) { if (! p->empty () && layout.is_valid_cell_index (p->back ())) { db::cell_index_type new_cell = layout.convert_cell_to_static (p->back ());