Angus Leeming wrote:
Abdelrazak Younes <[EMAIL PROTECTED]> writes:
Angus Leeming wrote:
So a summary of this patch might be: A BufferView requires a valid WorkArea, so make the code do that. (ATM, the code logic
is inverted.)

No, you got it wrong, that's exactly the opposite I want to achieve: a WorkArea needs a valid BufferView. I want the WorkArea to use the BufferView and the Bufferview to not even know about the WorkArea existence.

Please think what you are trying to achieve when you post a patch. It takes only
a few minutes to provide an overview summary and may even mean that you get
meaningful comments ;-)

Sorry, I thought my svn log was clear enough... I'll try to be more meaningful next time.


IMHO, not in this case. The problem of shared_ptr is that you don't know where they are reset. So I think it is wrong to pass shared_ptr around. They are very useful and I use them in my Gui and GuiImplemtation. Please find attached the header of these classes.

If LyXView "owns" a Foo* pointer (wrapped up as shared_ptr<Foo>) that means to
me tht only LyXView can delete the pointer. If that's the case,

Yes.

then you should
either provide a Foo& accessor for the case when a Foo& is always valid or
provide a weak_ptr<Foo> accessor for the case that sometimes the pointer is 
null.

I planned to put BOOST_ASSERT(ptr) everywhere but perhaps the weak_ptr method is cleaner... dunno. I need to read the boost doc.



That way, you document your usage semantics *in code*.

Agreed. The end goal is to use only "Foo&" accessors which are cleaner IMHO. But the road is long toward this goal. The LyXView class is used everywhere in the code! Sometimes just to access to the buffer which is accessible via the bufferview reference in LyXView...

By the way, could you explain me the rationale behind the BufferView_pimpl class? I cannot see any advantage of duplicating the Bufferview interface and I am very tempted to merge the two.

Abdel.

Reply via email to