]> git.lyx.org Git - features.git/commitdiff
Fix crash when inserting label before label in change tracking mode
authorJuergen Spitzmueller <spitz@lyx.org>
Mon, 5 Dec 2022 10:15:58 +0000 (11:15 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Mon, 5 Dec 2022 10:15:58 +0000 (11:15 +0100)
src/insets/InsetLabel.cpp
src/insets/InsetLabel.h

index 2c0c1e5194be2844a90267799f966f103516f92f..e143f83e29b066f54e5a77b826450589908aec85 100644 (file)
@@ -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,
index dba25f01c942475a61752cf9c862e9229feaece7..8032ce764938bc5b21eab10022a410121f0db4c6 100644 (file)
@@ -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_;
        ///