mirror of https://github.com/KLayout/klayout.git
Issue #1327 fixed (segfault in pymod finalization code)
This commit is contained in:
parent
c6bfb03a18
commit
63a4fe8d77
|
|
@ -1952,7 +1952,7 @@ public:
|
||||||
explicit LayoutLocker (db::Layout *layout = 0, bool no_update = false)
|
explicit LayoutLocker (db::Layout *layout = 0, bool no_update = false)
|
||||||
: mp_layout (layout), m_no_update (no_update)
|
: mp_layout (layout), m_no_update (no_update)
|
||||||
{
|
{
|
||||||
if (mp_layout) {
|
if (mp_layout.get ()) {
|
||||||
mp_layout->start_changes ();
|
mp_layout->start_changes ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1965,7 +1965,7 @@ public:
|
||||||
LayoutLocker (const LayoutLocker &other)
|
LayoutLocker (const LayoutLocker &other)
|
||||||
: mp_layout (other.mp_layout), m_no_update (other.m_no_update)
|
: mp_layout (other.mp_layout), m_no_update (other.m_no_update)
|
||||||
{
|
{
|
||||||
if (mp_layout) {
|
if (mp_layout.get ()) {
|
||||||
mp_layout->start_changes ();
|
mp_layout->start_changes ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1976,17 +1976,17 @@ public:
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
set (other.mp_layout, other.m_no_update);
|
set (const_cast<db::Layout *> (other.mp_layout.get ()), other.m_no_update);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
db::Layout *mp_layout;
|
tl::weak_ptr<db::Layout> mp_layout;
|
||||||
bool m_no_update;
|
bool m_no_update;
|
||||||
|
|
||||||
void set (db::Layout *layout, bool no_update)
|
void set (db::Layout *layout, bool no_update)
|
||||||
{
|
{
|
||||||
if (mp_layout) {
|
if (mp_layout.get ()) {
|
||||||
if (m_no_update) {
|
if (m_no_update) {
|
||||||
mp_layout->end_changes_no_update ();
|
mp_layout->end_changes_no_update ();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1995,7 +1995,7 @@ private:
|
||||||
}
|
}
|
||||||
mp_layout = layout;
|
mp_layout = layout;
|
||||||
m_no_update = no_update;
|
m_no_update = no_update;
|
||||||
if (mp_layout) {
|
if (mp_layout.get ()) {
|
||||||
mp_layout->start_changes ();
|
mp_layout->start_changes ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,9 @@ int run_pymodtest (tl::TestBase *_this, const std::string &fn)
|
||||||
tl::InputPipe pipe (cmd);
|
tl::InputPipe pipe (cmd);
|
||||||
tl::InputStream is (pipe);
|
tl::InputStream is (pipe);
|
||||||
text = is.read_all ();
|
text = is.read_all ();
|
||||||
|
|
||||||
|
// subprocess exits without error
|
||||||
|
EXPECT_EQ (pipe.wait(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
tl::info << text;
|
tl::info << text;
|
||||||
|
|
@ -89,6 +92,9 @@ PYMODTEST (import_db, "import_db.py")
|
||||||
PYMODTEST (import_rdb, "import_rdb.py")
|
PYMODTEST (import_rdb, "import_rdb.py")
|
||||||
PYMODTEST (import_lay, "import_lay.py")
|
PYMODTEST (import_lay, "import_lay.py")
|
||||||
|
|
||||||
|
// others
|
||||||
|
PYMODTEST (issue1327, "issue1327.py")
|
||||||
|
|
||||||
#if defined(HAVE_QT) && defined(HAVE_QTBINDINGS)
|
#if defined(HAVE_QT) && defined(HAVE_QTBINDINGS)
|
||||||
|
|
||||||
PYMODTEST (import_QtCore, "import_QtCore.py")
|
PYMODTEST (import_QtCore, "import_QtCore.py")
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
# KLayout Layout Viewer
|
||||||
|
# Copyright (C) 2006-2023 Matthias Koefferlein
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
import klayout.db as kdb
|
||||||
|
|
||||||
|
ly = kdb.Layout()
|
||||||
|
cell = ly.create_cell("TOP")
|
||||||
|
parents = cell.each_parent_cell()
|
||||||
|
|
||||||
|
# makes the unit test happy
|
||||||
|
print("OK")
|
||||||
|
|
||||||
|
# was crashing now in finalization code ..
|
||||||
|
|
||||||
Loading…
Reference in New Issue