1. Use obsharedptr instead of shared_ptr. obsharedptr is #defined to the...#21
Conversation
…the appropriate value 2. Add support for shared_ptrs to Python bindings. The following code now works: r = OBReaction() m = OBMol() r.AddReactant(m)
1. Use obsharedptr instead of shared_ptr. obsharedptr is #defined to the...
|
The commit message here could expand more on why the given Python snippet didn't work until now and why it does now. I'm getting segfaults in shared_ptr destructor since this commit (or the one which fixes the build failure introduced in this one): Or in the interpreter: This is backtrace: SWIG generated wrapper code is really hard to follow, but it fails in openbabel-python.cpp:_wrap_delete_OBMol() calling delete smartarg1. The issue is that it doesn't fail there every time so it might be some bad interaction between shared_ptr and SWIG and Python. Any ideas? |
|
I'm prepared to revert my code if we can't sort this out, as I think mol += molb is more important than reactions, but let's see first. "Why it didn't work till now?" The relevant function only takes a shared_ptr (OBReaction::AddReactant). What to do? Maybe I should revert the change to openbabel-python.i for the moment and see if there's some other way to handle reactants. Chris is the best person to talk this over with, but he's not active at the moment... (Note that the changes to the other files are still worthwhile and good. They bring all the shared_ptr handling to one point in our codebase.) |
|
I think the best course of action now would be to back out the changes from Python bindings and commit them once the issue is understood and fixed. I checked that just reverting changes to openbabel-python.i is enough. There are too many moving pieces in SWIG and shared_ptr, right now I don't completely understand how they interact. |
|
Please go ahead and commit it. On 21 November 2013 21:41, Reinis notifications@github.com wrote:
|
... appropriate value
r = OBReaction()
m = OBMol()
r.AddReactant(m)