mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
Fix crash when inserting label before label in change tracking mode
This commit is contained in:
parent
6c904004b6
commit
4d337e78ab
@ -99,7 +99,8 @@ void InsetLabel::updateLabelAndRefs(docstring const & new_label,
|
|||||||
UndoGroupHelper ugh(&buffer());
|
UndoGroupHelper ugh(&buffer());
|
||||||
if (cursor)
|
if (cursor)
|
||||||
cursor->recordUndo();
|
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
|
// With change tracking, we insert a new label and
|
||||||
// delete the old one
|
// delete the old one
|
||||||
InsetCommandParams p(LABEL_CODE, "label");
|
InsetCommandParams p(LABEL_CODE, "label");
|
||||||
@ -109,15 +110,15 @@ void InsetLabel::updateLabelAndRefs(docstring const & new_label,
|
|||||||
lyx::dispatch(FuncRequest(LFUN_CHAR_DELETE_FORWARD));
|
lyx::dispatch(FuncRequest(LFUN_CHAR_DELETE_FORWARD));
|
||||||
} else
|
} else
|
||||||
setParam("name", label);
|
setParam("name", label);
|
||||||
updateReferences(old_label, label);
|
updateReferences(old_label, label, changes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetLabel::updateReferences(docstring const & old_label,
|
void InsetLabel::updateReferences(docstring const & old_label,
|
||||||
docstring const & new_label)
|
docstring const & new_label, bool const changes)
|
||||||
{
|
{
|
||||||
UndoGroupHelper ugh(nullptr);
|
UndoGroupHelper ugh(nullptr);
|
||||||
if (buffer().masterParams().track_changes) {
|
if (changes) {
|
||||||
// With change tracking, we insert a new ref and
|
// With change tracking, we insert a new ref and
|
||||||
// delete the old one
|
// delete the old one
|
||||||
lyx::dispatch(FuncRequest(LFUN_MASTER_BUFFER_FORALL,
|
lyx::dispatch(FuncRequest(LFUN_MASTER_BUFFER_FORALL,
|
||||||
|
@ -98,7 +98,7 @@ private:
|
|||||||
void uniqueLabel(docstring & label) const;
|
void uniqueLabel(docstring & label) const;
|
||||||
///
|
///
|
||||||
void updateReferences(docstring const & old_label,
|
void updateReferences(docstring const & old_label,
|
||||||
docstring const & new_label);
|
docstring const & new_label, bool const changes);
|
||||||
///
|
///
|
||||||
docstring screen_label_;
|
docstring screen_label_;
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user