[C++-sig] Problem with boost::unordered_map and map_indexing_suite

2013-03-20 Thread Jay Riley
I've come across two problems with some python exporting Im trying to do. First problems is as follows. I have the following piece of python code: inv = ActiveGame.GetPlayerParty().GetInventory().GetItems() print str(len(inv))print type(inv)inv["Th

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] Extracting constant pointer to char* array from list

2013-03-20 Thread Alex Leach
Hi, I was wondering the best way to solve this problem:- void WrapperClass::parse_args(boost::python::list argv) { int argc = boost::python::len(argv); const char* const* pargv = boost::python::extractconst*>(argv); /// < WrappedClass::parse_args(argc, pargv); } This doesn't wo

[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