Re: [C++-sig] Segfaults in object deallocation

2013-03-24 Thread Alex Leach
Thanks for the reply, and apologies for the delay in mine; I've been struggling with classes having protected destructors. Sorted now though.. On Sat, 23 Mar 2013 03:02:58 -, Niall Douglas wrote: Separate C++ objects from their python wrappers. Have C++ objects held by shared_ptr. H

Re: [C++-sig] Segfaults in object deallocation

2013-03-22 Thread Niall Douglas
On 22 Mar 2013 at 14:33, Alex Leach wrote: > So, in Environment's destructor, which I thought was a no-op, FastMutex's > destructor is also being called. Now, that's a bit of a bummer. As far as > I can tell (I'm still very new to C++; coming from Python), unlike how I > hacked the initialis

Re: [C++-sig] Segfaults in object deallocation

2013-03-22 Thread Alex Leach
On Wed, 20 Mar 2013 15:52:52 -, Jim Bosch wrote: http://www.boost.org/doc/libs/1_53_0/libs/python/doc/v2/faq.html#threadsupport There are other people on this list who know a lot more about this than I do, but my understanding has always been that it you use Boost.Python with threadin

Re: [C++-sig] Segfaults in object deallocation

2013-03-21 Thread Alex Leach
On Wed, 20 Mar 2013 19:28:35 -, Jeffrey Van Voorst wrote: In short, the boost smart pointers, boost spirit, etc. implementations vary depending on the compile time options. I don't know if boost.python has options. Hi again, So I've just rebuilt everything to be compatible with Pyt

Re: [C++-sig] Segfaults in object deallocation

2013-03-20 Thread Niall Douglas
On 20 Mar 2013 at 18:43, Alex Leach wrote: > Thanks for that link. I checked out the tnfox library, which the FAQ > refers to as having a thread-safe implementation of invoke.hpp. tnfox, > whatever it is, also has an extensive indexing_suite, complete with a > template for std::list containe

Re: [C++-sig] Segfaults in object deallocation

2013-03-20 Thread Alex Leach
On Wed, 20 Mar 2013 19:28:35 -, Jeffrey Van Voorst wrote: This could be misinformation, but some of the boost libraries have compile time flags that depend on whether or not threading is enabled. As an example, I was running into issues with an invalid free() with respect to shared_

Re: [C++-sig] Segfaults in object deallocation

2013-03-20 Thread Alex Leach
On Wed, 20 Mar 2013 19:27:34 -, Jim Bosch wrote: (btw, this reply seemed to only go to me rather than the list) oh, sorry... Need to get into a habit of double-checking the reply address.. On 03/20/2013 02:16 PM, Alex Leach wrote: void PyEnv::ResetPyList(const boost::python::list&

Re: [C++-sig] Segfaults in object deallocation

2013-03-20 Thread Jeffrey Van Voorst
This could be misinformation, but some of the boost libraries have compile time flags that depend on whether or not threading is enabled. As an example, I was running into issues with an invalid free() with respect to shared_ptr (in the cctbx project). Unfortunately, (for your case) the fix wa

Re: [C++-sig] Segfaults in object deallocation

2013-03-20 Thread Alex Leach
On Wed, 20 Mar 2013 15:52:52 -, Jim Bosch wrote: http://www.boost.org/doc/libs/1_53_0/libs/python/doc/v2/faq.html#threadsupport Thanks for that link. I checked out the tnfox library, which the FAQ refers to as having a thread-safe implementation of invoke.hpp. tnfox, whatever it is,

Re: [C++-sig] Segfaults in object deallocation

2013-03-20 Thread Alex Leach
On Wed, 20 Mar 2013 16:53:55 -, Alex Leach wrote: I've put it in a "boost_helpers" folder in my own project, but I'd be perfectly happy if someone wanted to put it in mainline boost. I attach it here, if you're interested in having it ;) Sorry, forgot to attach... Btw, the sort metho

Re: [C++-sig] Segfaults in object deallocation

2013-03-20 Thread Alex Leach
Thanks for your replies! On Wed, 20 Mar 2013 16:34:00 -, Jim Bosch wrote: I don't think shared_ptr would help here (and you almost certainly don't want to inherit from it), though I'm curious what you're using to wrap std::list, as you clearly have methods that return std::list, and t

Re: [C++-sig] Segfaults in object deallocation

2013-03-20 Thread Jim Bosch
On 03/20/2013 12:23 PM, Alex Leach wrote: Hope that helps. I'm guessing that the problem might be fixed if I inherit from boost::shared_ptr, but I have no idea why I would need to do that here and not elsewhere. Or perhaps I've done something wrong. I'm sure the iterator and enumerator methods w

Re: [C++-sig] Segfaults in object deallocation

2013-03-20 Thread Alex Leach
On Wed, 20 Mar 2013 15:54:45 -, Jaedyn K. Draper wrote: Can you send the C++ code of MyObj? Kind of hard to diagnose a C++-side crash without any C++ code. Sure. Sorry, thought previous email was getting long and it might have been an obvious fix for someone... Just writing a

Re: [C++-sig] Segfaults in object deallocation

2013-03-20 Thread Jaedyn K. Draper
Can you send the C++ code of MyObj? Kind of hard to diagnose a C++-side crash without any C++ code. On 3/20/2013 9:46 AM, Alex Leach wrote: Dear list, I've started using Boost.Python to wrap a 3rd party C++ library, and whilst running my un

Re: [C++-sig] Segfaults in object deallocation

2013-03-20 Thread Jim Bosch
On 03/20/2013 10:46 AM, Alex Leach wrote: Dear list, I've started using Boost.Python to wrap a 3rd party C++ library, and whilst running my unit tests, the Python interpreter segfault's during garbage collection. With explicit object deletion: $ gdb -q --args python -c 'import mylib; obj = myl

[C++-sig] Segfaults in object deallocation

2013-03-20 Thread Alex Leach
Dear list, I've started using Boost.Python to wrap a 3rd party C++ library, and whilst running my unit tests, the Python interpreter segfault's during garbage collection. With explicit object deletion: $ gdb -q --args python -c 'import mylib; obj = mylib.MyObj(); del(obj)' ... *** Error in