Skip to content

Conversation

@yungyuc
Copy link
Member

@yungyuc yungyuc commented Jul 16, 2022

The linear_wave app uses PySide6 for matplotlib to create a new window, and it seems to conflict with the shutdown sequence of python interpreter.

Change the interpreter shotdown order to fix it.

In addition, improve the interpreter wrapping API. Do not initialize the interpreter in the constructor of the class Interpreter.

ref #100

The linear_wave app uses PySide6 for matplotlib to create a new window, and it seems to conflict with the shutdown sequence of python interpreter.

Change the interpreter shotdown order to fix it.

In addition, improve the interpreter wrapping API.  Do not initialize the interpreter in the constructor of the class Interpreter.
@yungyuc yungyuc added the bug Something isn't working label Jul 16, 2022
@yungyuc yungyuc self-assigned this Jul 16, 2022

int main(int argc, char ** argv)
{
// Set up Python interpreter.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initialize the interpreter in the beginning of program.

Interpreter & Interpreter::initialize()
{
setup_path();
if (nullptr == m_interpreter)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not re-enter the initialization.

Interpreter & Interpreter::finalize()
{
// NOLINTNEXTLINE(readability-delete-null-pointer)
if (nullptr != m_interpreter)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid null dereferencing.


RApplication::~RApplication()
{
// Shuts down the interpreter when the application stops.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shuts down interpreter when the application is finishing.

from modmesh.app import linear_wave as app
svr = app.run_linear()
# Need to hold the win object to keep PySide alive.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manage the lifecycle in the application region.

@yungyuc yungyuc marked this pull request as ready for review July 16, 2022 13:44
@yungyuc yungyuc merged commit e2de7ce into solvcon:master Jul 16, 2022
@yungyuc yungyuc deleted the fix-crash-on-exit branch July 16, 2022 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant