Crash when changing shortcut bind file

Jean-Marc Lasgouttes lasgouttes at lyx.org
Thu Mar 10 12:41:31 UTC 2022


Le 08/03/2022 à 16:53, Scott Kostyshak a écrit :
> On Tue, Mar 08, 2022 at 04:43:38PM +0100, Kornel Benko wrote:
>> Open UserGuide.lyx
>> goto 2.1 Basic File Operations, so that some shortcuts are visible
>> change the bind-file from cua to emacs
>> 	Tools-Preferences...->Editing->Shortcuts->Bind file: emacs ==> crash
> 
> I can reproduce. In addition to a SIGSEGV, I get the following output that perhaps is useful:
> 
>    /home/scott/lyxbuilds/master-master/repo/src/Paragraph.cpp:4283:12: runtime error: member access within misaligned address 0x00650000006f for type 'struct Private', which requires 8 byte alignment
>    0x00650000006f: note: pointer points here
>    <memory cannot be printed>

This is the result of the InsetInfo mess. This inset is hackish in 
various ways. In 12dfdbf0a3e6, I have tried a new strategy, we'll see 
whether  it works. I am reasonably confident, but not totally. Something 
had to be done anyway (see commit message below).

Testing welcome.

JMarc

commit 12dfdbf0a3e667544fd3f0af7fe86b26909fd6a0
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Thu Mar 10 12:19:44 2022 +0100

     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().


More information about the lyx-devel mailing list