]> git.lyx.org Git - lyx.git/commit
Fix crash in InsetInfo when bindings change
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 10 Mar 2022 11:19:44 +0000 (12:19 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 10 Mar 2022 11:45:07 +0000 (12:45 +0100)
commit12dfdbf0a3e667544fd3f0af7fe86b26909fd6a0
tree0101bab953b59f954c081010b1cc34005fe5dede
parent498a5cd487482f1a97c2c9f305b9e10fc041631e
Fix crash in InsetInfo when bindings change

This is actually a generic InsetInfo issue:

1/ the contents of the inset is computed in updateBuffer, so that it
   is available for drawing but also for latex output (think batch
   export). When it is called, it deletes the existing inner paragraph
   and replaces it by a new one

2/ metrics build a new Row object that represents to paragraph

3/ draw() relies on this information

Now, imagine that updateBuffer() is called after metrics(). This can
happen for many reasons, and does happen here (display a shortcut info
and change the shortcut file from cua to emacs).

This problem has been here forever, but is only visible now that the
(experimental) bookmark display code needs to read the underlying
paragraph id.

The solution is to compute the inset contents at metrics time. This
is done by moving the relevant code to a new standalone build() method
that is called in metrics() but also in latex().
src/insets/InsetInfo.cpp
src/insets/InsetInfo.h