on Sat Nov 15 2008, "Leonard Ritter" <paniq-AT-paniq.org> wrote:

> I think I know what the issue is, and it indeed relates to a piece of code I 
> have
> not posted yet.
>
> void Actor::add(const ActorPtr &actor) {
>     assert(actor);
>     assert(!actor->parent);
>     actor->parent = ActorPtr(this);

Whoa, this is very bad juju.  Who/what is managing the lifetime of *this
before this call is made?  Afterwards, you have two owners for *this.

>     children.push_back(actor);
>     queue_redraw();
> }
>
> Actor is a tree element with children and a parent pointer. I guess
> that assigning ActorPtr(this) appears to construct a new pointer for
> an object that is already registered to boost.python.

Given what you write above, my first guess is that you want to be using
both weak_ptr and shared_from_this in your design.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to