Re: refptr and this



On Fri, 2008-02-15 at 23:36 -0600, Jonathon Jongsma wrote:
> The problem is, the set_parent() function takes a Glib::RefPtr<>, so I
> would need to do something like
>  child->set_parent(Glib::RefPtr<Item>(this));
> Except this seems to cause refcounting problems and the program
> crashes.
> 
> I can obviously revert to the C API and do something like:
> goo_canvas_item_set_parent (child->gobj (), GOO_CANVAS_ITEM(gobj ()));
> But it would be nice not to have to do that.  Any ideas?

Looks like you need to implement something to
boost::enable_shared_from_this

;-)

Hub



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]