[C++-sig] Segfaults in object deallocation
Jim Bosch
talljimbo at gmail.com
Wed Mar 20 17:34:00 CET 2013
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 will be broken - haven't
> got around to testing them yet - but I don't see why destroying the
> object would cause segfaults on these classes.. Any clues??
>
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 the
standard library can be tricky to translate to Python due to things like
iterator invalidation. That said, containers of strings are much less
tricky than containers of wrapped objects. And given that your Python
example that segfaults doesn't involve those methods at all, they
probably aren't at fault.
To me, everything thing here looks pretty straightforward, except the
multithreading...which leads me to suspect that the multithreading is
the problem. And that's something I'm afraid I don't know enough to
help you with.
Jim
More information about the Cplusplus-sig
mailing list