On 03/22/2015 09:14 AM, Georg Baum wrote:
Jean-Marc Lasgouttes wrote:

Le 20/03/15 21:53, Georg Baum a écrit :
The real cause for the bug is that ArgumentProxy::mathMacro_ is a
reference to an object which is stored in a MathData, which is a
std::vector storing MathAtoms by value (not pointers). Therefore, each
time when the MathData object which contains a math macro instance is
resized, the ArgumentProxy::mathMacro_ members of its arguments may
become invalid. In case of bug 9418 the resizing happens because only
macro \a is copied to the clipboard, and macro \b is not, therefore \b is
converted to an unknown inset and its argument is put as a separate inset
after \b.
What about using a std::list or our own RandomAccessList instead of
std::vector?
Good idea. The random access is needed, so std::list does not work. Using
RandomAccessList seems to work, but MathData is a very central part of
mathed, so this would need very intensive testing. Also, some of the loops
should be rewritten using iterators to avoid recomputation of the current
iterator. General performance testing (memory and speed) would be needed as
well.

In total I am not sure whether we should go that way. I would rather try to
rework ArgumnentProxy (or get rid of it) to better match the general mathed
structure: Each inset is self contained and does not need to know anything
about other insets.

I'd join this conversation, but this is beyond my competence to judge.

If there's a worry about testing, I think we have some time before 2.2. We can always back it out if need be and do something simpler.

Richard

Reply via email to