-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
segfault when destructing class instance containing loaded py::module and py::scoped_interpreter #1358
Comments
Does switching the order of the private definitions change the behavior?
|
Try swapping the order of these two members: py::module plugin;
py::scoped_interpreter interp; Destruction occurs in reverse order of declaration, so as currently written the |
Ah, this explains it (and fixes the issue). It does bring another issue back that I thought "fixed" by getting a segfault instead. With the plugin system I'm building in the repo referenced above, I want to fire off some worker threads and just detach them when I no longer need them. Detaching these threads (running Python scripts via pybind11) and destructing the Any case, this particular issue can be closed. |
That sounds like a similar issue: a |
Closing in favour of #1360. |
Issue description
Example code segfault with the following backtrace instead of exiting normally.
Omitting the call to
plugin_handler::load_plugins()
makes the example quit normally.Code was compiled with GCC 7.3.0, using pybind11 fd9bc8f (current master HEAD).
Reproducible example code
The text was updated successfully, but these errors were encountered: