Skip to content

Conversation

@jnbrunet
Copy link
Contributor

This PR make use of a custom py_shared_ptr holder type that will hold
the virtual pointers to SOFA objects (inheriting from Base). The holder
also keeps an internal copy of the initial python object to avoid slicing
when the latter gets deleted by python before the C++ wrapper.

This commit also brings several clean-up to the overall source code of the
bindings.

fredroy and others added 2 commits December 15, 2020 21:53
This commit make use of a custom py_shared_ptr holder type that will hold
the virtual pointers to SOFA objects (inheriting from Base). The holder
also keeps an internal copy of the initial python object to avoid slicing
when the latter gets deleted by python before the C++ wrapper.

This commit also brings several cleanup to the overall source code of the
bindings.
@jnbrunet jnbrunet added this to the V20.12 milestone Dec 21, 2020
@jnbrunet jnbrunet requested a review from fredroy December 21, 2020 14:13
@jnbrunet jnbrunet self-assigned this Dec 21, 2020
@fredroy fredroy merged commit 3e7589c into sofa-framework:master Dec 22, 2020
@jnbrunet jnbrunet deleted the redesign_holder_types branch December 23, 2020 07:19
damienmarchal added a commit to CRIStAL-PADR/plugin.SofaPython3 that referenced this pull request Apr 11, 2022
The object created from python needs special care to avoid being deleted by
the python garbage collection mecanisme.
In sofa-framework#74 and sofa-framework#75 the smart pointer mecanism was refactored. The refactoring
added a py::keep_alive, in addObject but didn't in other functions.

The PR fix this.
fredroy pushed a commit that referenced this pull request Apr 13, 2022
The object created from python needs special care to avoid being deleted by
the python garbage collection mecanisme.
In #74 and #75 the smart pointer mecanism was refactored. The refactoring
added a py::keep_alive, in addObject but didn't in other functions.

The PR fix this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants