Merge pull request #467 from KLayout/issue-466

Issue 466
This commit is contained in:
Matthias Köfferlein 2020-01-05 01:03:10 +01:00 committed by GitHub
commit db1d05282d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 0 deletions

View File

@ -1935,6 +1935,10 @@ LayoutView::expand_properties (unsigned int index, const std::map<int, int> &map
void
LayoutView::replace_layer_node (unsigned int index, const LayerPropertiesConstIterator &iter, const LayerPropertiesNode &node)
{
if (index >= layer_lists ()) {
return;
}
// if the source specification changed, a redraw is required
if (*iter != node) {
@ -1968,6 +1972,10 @@ LayoutView::replace_layer_node (unsigned int index, const LayerPropertiesConstIt
void
LayoutView::set_properties (unsigned int index, const LayerPropertiesConstIterator &iter, const LayerProperties &props)
{
if (index >= layer_lists ()) {
return;
}
// if the source specification changed, a redraw is required
const LayerProperties &l = *iter;
if (l != props) {
@ -2007,6 +2015,8 @@ LayoutView::set_properties (unsigned int index, const LayerPropertiesConstIterat
const LayerPropertiesNode &
LayoutView::insert_layer (unsigned int index, const LayerPropertiesConstIterator &before, const LayerPropertiesNode &node)
{
tl_assert (index < layer_lists ());
if (transacting ()) {
manager ()->queue (this, new OpInsertLayerProps (index, (unsigned int) before.uint (), node));
} else if (manager () && ! replaying ()) {
@ -2032,6 +2042,10 @@ LayoutView::insert_layer (unsigned int index, const LayerPropertiesConstIterator
void
LayoutView::delete_layer (unsigned int index, LayerPropertiesConstIterator &iter)
{
if (index >= layer_lists ()) {
return;
}
lay::LayerPropertiesNode orig = *iter;
if (mp_control_panel && index == current_layer_list ()) {

View File

@ -397,6 +397,13 @@ class LAYLayoutView_TestClass < TestBase
lp.fill_color = 0xffff31cc
assert_equal(lv.begin_layers.current.fill_color, 0xffff31cc)
# should not segfault
begin
lv.insert_layer(42, lv.begin_layers(42))
assert_equal(true, false)
rescue => ex
end
end
end