On Tuesday 18 February 2003 5:27 pm, Andre Poenitz wrote:
> On Tue, Feb 18, 2003 at 05:11:44PM +0000, Angus Leeming wrote:
> > So, it is quite conceivable for a CacheItem to exist on the grfx::Cache
> > after the BufferView has been destroyed but before the 2 second timer has
> > returned.
>
> Ok.
>
> Next question: 

Help, help. I'm drowwwnnnning... glug, glug, .... silence.

> Is it ok to have
>
>      weak_ptr<> ... view_
>      BufferView * view() { return view_ }
>      [...]
>      weak_ptr<> bv = view();
>
> or do we need:
>
>      weak_ptr<> ... view_
>      weak_ptr<> view() { return view_ }
>      [...]
>      weak_ptr<> bv = view();

Ghostly voice from a passing cloud:

class SomeInset {
        void cache_and_draw(BufferView * bv, ...) {
                cache(bv);
                draw(bv, ...);
        }
        void cache(BufferView * bv) {
                view_ = bv->owner()->view();
        }
        BufferView * view() { return view_.get(); }
        boost::weak_ptr<BufferView> view_;
};

Angus

Reply via email to