Abdelrazak Younes wrote:

> The think is that once we add the additional argument somewhere then it
> will be needed to all methods in the calling hierarchy (butterfly effect).

It is already used in almost all functions. I do not like that, but see no
better solution.

> Passing BufferView to every method of InsetBase does not seem very clean
> to me. I would prefer to add a BufferView reference member to InsetBase
> filled at construction. I don't think InsetBase should be BufferView
> independent but perhaps I am wrong. What do you think?

We have that in tabular and text insets. This member gets out of date and
causes real bugs (we fixed some tabular related ones in 1.4.x).

The main problem is that InsetBase needs to have a default constructur
because it is used in STL containers. Therefore we cannot guarantee that
the BufferView pointer is valid (a reference would not work for the same
reason).

If you want to get some nice crashes add some BOOST_ASSERT(cell.bv_owner)
(or similar, from memory) in insettabular.

But even if you could eliminate the default constructor: You would need the
bv at construction time of the inset. This would cause the same butterfly
effect (I tried that for tabulars).


Georg

Reply via email to