-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Problems with shared_ptr re-entry #14
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
Comments
Hi Luka, thanks for tracking that down -- the fix ended up being a bit more involved. Please double-check that it works for you and let me know in case it doesn't. Thanks, |
wjakob
pushed a commit
that referenced
this issue
Nov 24, 2015
Wow, that was fast. I will check it out as soon as I can, but just looking at the code it appears that the fix is integrated well. Thanks. |
knarfS
added a commit
to knarfS/pybind11
that referenced
this issue
Apr 10, 2020
This is a fix for SmuView issue pybind#14.
knarfS
added a commit
to knarfS/pybind11
that referenced
this issue
Apr 11, 2020
This is a fix for SmuView issue pybind#14.
knarfS
added a commit
to knarfS/pybind11
that referenced
this issue
Apr 20, 2020
This is a fix for SmuView issue pybind#14.
knarfS
added a commit
to knarfS/pybind11
that referenced
this issue
Aug 15, 2020
This is a fix for SmuView issue pybind#14.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In a project where I am using pybind11 I had a problem with C++ objects wrapped in shared_ptr that were handed over to Python and then re-entered C++. With default approach (using PYBIND11_DECLARE_HOLDER_TYPE) this results in two smart pointers that do not know about each other. Using std::enable_shared_from_this template in my objects I have modified the code generated by PYBIND11_DECLARE_HOLDER_TYPE to something like (basically there is only one small difference at line 7):
I hope that this will save some time to anyone who will have the same scenario. If there is a good way to support this by default in some way it would be also very nice. I am not that familiar with C++ templates, but I guess the template could be limited to classes that inherit from std::enable_shared_from_this.
The text was updated successfully, but these errors were encountered: