-
Notifications
You must be signed in to change notification settings - Fork 56
Fix viewer crash with linear_wave app loaded #102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
|
|
||
| int main(int argc, char ** argv) | ||
| { | ||
| // Set up Python interpreter. |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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.
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