Andre Poenitz wrote: > What is that?
It is a safe way of holding a pointer whose memory is allocated elsewhere: > [Especially: Why is it used in FormulaBase, Angus?] class LyXView { /** return the current buffer view Returned as a shared_ptr so that anything wanting to cache the buffer view can do so safely using a boost::weak_ptr. */ boost::shared_ptr<BufferView> const & view() const; protected: /// view of a buffer. Eventually there will be several. boost::shared_ptr<BufferView> bufferview_; }; If formulabase stores its cached BufferView in a boost::weak_ptr, then destruction of LyXView::bufferview_ will cause the FormulaBase's boost::weak_ptr<BufferView> view_ to return 0 in a call BufferView * cachedbv = view_.get(); if (cachedbv == 0) // do nothing. the parent pointer has been destroyed. -- Angus