Skip to content

Commit

Permalink
Merge pull request #467 from KLayout/issue-466
Browse files Browse the repository at this point in the history
Issue 466
  • Loading branch information
klayoutmatthias authored Jan 5, 2020
2 parents 6a996b6 + aa268d3 commit db1d052
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/laybasic/laybasic/layLayoutView.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 ()) {
Expand All @@ -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 ()) {
Expand Down
7 changes: 7 additions & 0 deletions testdata/ruby/layLayoutView.rb
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,13 @@ def test_3
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
Expand Down

0 comments on commit db1d052

Please sign in to comment.