Merge pull request #1547 from KLayout/issue-1542

Issue 1542 - crash on exit
This commit is contained in:
Matthias Köfferlein 2023-11-26 22:19:04 +01:00 committed by GitHub
commit 6c4e082fc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 2 deletions

View File

@ -390,6 +390,8 @@ PythonInterpreter::~PythonInterpreter ()
m_stdout = PythonPtr ();
m_stderr = PythonPtr ();
sp_interpreter = 0;
if (m_embedded) {
Py_Finalize ();
@ -400,8 +402,6 @@ PythonInterpreter::~PythonInterpreter ()
}
}
sp_interpreter = 0;
}
char *

View File

@ -191,6 +191,18 @@ class KLayoutMain_TestClass < TestBase
end
def test_12
# Application.exit(0) - Python
out = `#{self.klayout_bin} -z -r #{File.join(File.dirname(__FILE__), "test12.py")} 2>&1`
assert_equal(out, "Before exit()\n")
# Application.exit(0) - Ruby
out = `#{self.klayout_bin} -z -r #{File.join(File.dirname(__FILE__), "test12.rb")} 2>&1`
assert_equal(out, "Before exit()\n")
end
end
load("test_epilogue.rb")

4
testdata/klayout_main/test12.py vendored Normal file
View File

@ -0,0 +1,4 @@
print("Before exit()")
pya.Application.instance().exit(0)

5
testdata/klayout_main/test12.rb vendored Normal file
View File

@ -0,0 +1,5 @@
$stdout.puts("Before exit()")
$stdout.flush
RBA::Application::instance.exit(0)