Bug report: SIGSEGV when copying cross-reference from "description" layout on LyX 2.4.0 beta 5
Thibaut Cuvelier
dourouc05 at gmail.com
Fri Sep 15 13:41:34 UTC 2023
On Fri, 15 Sept 2023 at 11:36, Jürgen Spitzmüller <jspitzm at gmail.com> wrote:
> Am Freitag, dem 15.09.2023 um 10:45 +0200 schrieb Léo de Souza:
> > 1. Create new document: File > New
> > 2. Insert label: Insert > Label...
> > 3. On a new line, switch layout to "Labeling" or "Description"
> > 4. Insert cross-reference: Insert > Cross-Reference...
> > 5. Try copying this cross-reference
> >
> > Expected result (LyX 2.3.6): The cross-reference is copied to the
> > clipboard.
> >
> > Actual result (LyX 2.4.0 beta 5): LyX crashes with the message
> > "SIGSEGV signal caught!"
>
>
> Nullpointer issue due to local_font being non-defined in
> InsetRef::xhtml().
>
> The attached patch fixes this particular case, but there are many
> similar uses in insets's xhtml methods which would need to be audited.
>
> Thibaut, Riki?
>
Your patch looks fine to me.
It looks cumbersome, especially if we need to do that several times; maybe
we could have a method at the inset level, say getLocalFontOrDefault(const
OutputParams&), to return either OutputParams::local_font if it exists or
buffer().params() otherwise? It would make correct code (much) easier to
write.
(Wasn't this bug caught at some point by a static analyser? It seems to be
a too common error in C++ for it to slip through.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20230915/b7f5443c/attachment.html>
More information about the lyx-devel
mailing list