SIGSEGV when doing undo after putting bib items in a note
Jean-Marc Lasgouttes
lasgouttes at lyx.org
Tue Jul 16 13:48:49 UTC 2024
Le 15/07/2024 à 18:14, Scott Kostyshak a écrit :
>> I cannot reproduce, but the following patch makes sense. Does it work?
>
> Yes it fixes the behavior both with and without change tracking.
Thanks, I pushed it to master. I am very surprised to see such a nasty
error in our undo code. I thought it was kind of stable now.
Riki, this is obviously candidate for branch.
JMarc
commit 82f387dabc2b18de6a9917192f4304e92bff8bc1
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date: Tue Jul 16 15:43:11 2024 +0200
Fix faulty undo recording
The recordUndo() call is very wrong, since we may be inserting over a
selection covering several paragraphs (undo itself works at paragraph
granularity).
recordUndoSelection() is the right operation in this case. It is
equivalent to recordUndo() when there is no selection.
---
src/Text.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Text.cpp b/src/Text.cpp
index 2a5ff9f0b8..d56cd10268 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -3600,7 +3600,7 @@ bool doInsertInset(Cursor & cur, Text * text,
if (InsetCollapsible * ci = inset->asInsetCollapsible())
ci->setButtonLabel();
- cur.recordUndo();
+ cur.recordUndoSelection();
if (cmd.action() == LFUN_ARGUMENT_INSERT) {
bool cotextinsert = false;
InsetArgument * const ia = static_cast<InsetArgument *>(inset);
More information about the lyx-devel
mailing list