[C++-sig] boost::python and boost::shared_ptr strict weak ordering problem

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Sat Aug 2 00:57:29 CEST 2008


I think your guess is very good. I stumbled over this, too, a while ago:

http://mail.python.org/pipermail/c++-sig/2006-March/010407.html

This lead me to redesign my parent-child classes in order to completely avoid
smart pointers in the interfaces (they are still used "under the hood").

Ralf

> PS: After debugging a little bit my wild guess is, that boost.python
> uses the shared_ptr objects with
> custom deleter function that decrements the python refcount. And such
> custom shared_ptrs are created
> every time a C++ function with an shared_ptr argument is called (while
> incrementing the python refcount).
> Which seems to work fine but (IMO) breaks the less than operator of
> boost::shared_ptr documented at
> [http://www.boost.org/doc/libs/1_35_0/libs/smart_ptr/shared_ptr.htm#functions]
> - but as already said, it's
> only a wild guess.



More information about the Cplusplus-sig mailing list