Boost logo

Boost :

From: David Turner (dkturner_at_[hidden])
Date: 2004-03-03 23:22:34


Hi

> > In fact, window is defined thus:
> >
> > typedef boost::shared_ptr<window_base> window;
>
> I think this can easily lead to retain-cycles, as widgets will often
> need a pointer to their window, which must be a weak pointer,
> as there
> are otherwise no ways to get the reference count of the
> window down to
> zero, without first having to remove all the widgets who keep a
> reference to their window.

That is, of course, up to the implementer. In fact, my Win32
implementation makes use of a boost::weak_ptr back to the container, to
accommodate the auto-sizing mechanism. The GTK implementation has no
need of this. It's all an implementation detail. If you have a look at
the source code, you'll notice that widget_base declares a member
returning a pointer to an undefined implementation class. I'm toying
with the idea of exposing this on a per-platform basis.

Regards
David Turner


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk