mirror of https://github.com/KLayout/klayout.git
Fixed #466 (Segfault when accessing a wrong layer tab)
This commit is contained in:
parent
85c033db64
commit
09f97aa286
|
|
@ -1935,6 +1935,10 @@ LayoutView::expand_properties (unsigned int index, const std::map<int, int> &map
|
||||||
void
|
void
|
||||||
LayoutView::replace_layer_node (unsigned int index, const LayerPropertiesConstIterator &iter, const LayerPropertiesNode &node)
|
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 the source specification changed, a redraw is required
|
||||||
if (*iter != node) {
|
if (*iter != node) {
|
||||||
|
|
||||||
|
|
@ -1968,6 +1972,10 @@ LayoutView::replace_layer_node (unsigned int index, const LayerPropertiesConstIt
|
||||||
void
|
void
|
||||||
LayoutView::set_properties (unsigned int index, const LayerPropertiesConstIterator &iter, const LayerProperties &props)
|
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
|
// if the source specification changed, a redraw is required
|
||||||
const LayerProperties &l = *iter;
|
const LayerProperties &l = *iter;
|
||||||
if (l != props) {
|
if (l != props) {
|
||||||
|
|
@ -2007,6 +2015,8 @@ LayoutView::set_properties (unsigned int index, const LayerPropertiesConstIterat
|
||||||
const LayerPropertiesNode &
|
const LayerPropertiesNode &
|
||||||
LayoutView::insert_layer (unsigned int index, const LayerPropertiesConstIterator &before, const LayerPropertiesNode &node)
|
LayoutView::insert_layer (unsigned int index, const LayerPropertiesConstIterator &before, const LayerPropertiesNode &node)
|
||||||
{
|
{
|
||||||
|
tl_assert (index < layer_lists ());
|
||||||
|
|
||||||
if (transacting ()) {
|
if (transacting ()) {
|
||||||
manager ()->queue (this, new OpInsertLayerProps (index, (unsigned int) before.uint (), node));
|
manager ()->queue (this, new OpInsertLayerProps (index, (unsigned int) before.uint (), node));
|
||||||
} else if (manager () && ! replaying ()) {
|
} else if (manager () && ! replaying ()) {
|
||||||
|
|
@ -2032,6 +2042,10 @@ LayoutView::insert_layer (unsigned int index, const LayerPropertiesConstIterator
|
||||||
void
|
void
|
||||||
LayoutView::delete_layer (unsigned int index, LayerPropertiesConstIterator &iter)
|
LayoutView::delete_layer (unsigned int index, LayerPropertiesConstIterator &iter)
|
||||||
{
|
{
|
||||||
|
if (index >= layer_lists ()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
lay::LayerPropertiesNode orig = *iter;
|
lay::LayerPropertiesNode orig = *iter;
|
||||||
|
|
||||||
if (mp_control_panel && index == current_layer_list ()) {
|
if (mp_control_panel && index == current_layer_list ()) {
|
||||||
|
|
|
||||||
|
|
@ -397,6 +397,9 @@ class LAYLayoutView_TestClass < TestBase
|
||||||
lp.fill_color = 0xffff31cc
|
lp.fill_color = 0xffff31cc
|
||||||
assert_equal(lv.begin_layers.current.fill_color, 0xffff31cc)
|
assert_equal(lv.begin_layers.current.fill_color, 0xffff31cc)
|
||||||
|
|
||||||
|
# should not segfault
|
||||||
|
lv.insert_layer(42, lv.begin_layers(42))
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue