[LyX/master] Fix crash when inserting label before label in change tracking mode
Juergen Spitzmueller
spitz at lyx.org
Mon Dec 5 09:20:53 UTC 2022
commit 4d337e78ab3c31e8b1febdce75879c6124bcc21b
Author: Juergen Spitzmueller <spitz at lyx.org>
Date: Mon Dec 5 11:15:58 2022 +0100
Fix crash when inserting label before label in change tracking mode
---
src/insets/InsetLabel.cpp | 9 +++++----
src/insets/InsetLabel.h | 2 +-
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/insets/InsetLabel.cpp b/src/insets/InsetLabel.cpp
index 2c0c1e5..e143f83 100644
--- a/src/insets/InsetLabel.cpp
+++ b/src/insets/InsetLabel.cpp
@@ -99,7 +99,8 @@ void InsetLabel::updateLabelAndRefs(docstring const & new_label,
UndoGroupHelper ugh(&buffer());
if (cursor)
cursor->recordUndo();
- if (buffer().masterParams().track_changes) {
+ bool const changes = buffer().masterParams().track_changes;
+ if (changes) {
// With change tracking, we insert a new label and
// delete the old one
InsetCommandParams p(LABEL_CODE, "label");
@@ -109,15 +110,15 @@ void InsetLabel::updateLabelAndRefs(docstring const & new_label,
lyx::dispatch(FuncRequest(LFUN_CHAR_DELETE_FORWARD));
} else
setParam("name", label);
- updateReferences(old_label, label);
+ updateReferences(old_label, label, changes);
}
void InsetLabel::updateReferences(docstring const & old_label,
- docstring const & new_label)
+ docstring const & new_label, bool const changes)
{
UndoGroupHelper ugh(nullptr);
- if (buffer().masterParams().track_changes) {
+ if (changes) {
// With change tracking, we insert a new ref and
// delete the old one
lyx::dispatch(FuncRequest(LFUN_MASTER_BUFFER_FORALL,
diff --git a/src/insets/InsetLabel.h b/src/insets/InsetLabel.h
index dba25f0..8032ce7 100644
--- a/src/insets/InsetLabel.h
+++ b/src/insets/InsetLabel.h
@@ -98,7 +98,7 @@ private:
void uniqueLabel(docstring & label) const;
///
void updateReferences(docstring const & old_label,
- docstring const & new_label);
+ docstring const & new_label, bool const changes);
///
docstring screen_label_;
///
More information about the lyx-cvs
mailing list