diff --git a/src/Undo.cpp b/src/Undo.cpp index 143af4e83f..a479728ebd 100644 --- a/src/Undo.cpp +++ b/src/Undo.cpp @@ -643,6 +643,13 @@ void Undo::recordUndoFullBuffer(CursorData const & cur) /// UndoGroupHelper class stuff +/** FIXME: handle restarted groups + * It may happen that the buffers are visited in order buffer1, + * buffer2, buffer1. In this case, we want to have only one undo group + * in buffer1. One solution is to replace buffer_ with a set, + * but I am not sure yet how to do it. A use case is + * InsetLabel::updateReferences. + */ void UndoGroupHelper::resetBuffer(Buffer * buf) { if (buf == buffer_) diff --git a/src/Undo.h b/src/Undo.h index 59f3ca44fc..70897bfa28 100644 --- a/src/Undo.h +++ b/src/Undo.h @@ -135,7 +135,7 @@ private: */ class UndoGroupHelper { public: - UndoGroupHelper(Buffer * buf) : buffer_(0) + UndoGroupHelper(Buffer * buf = 0) : buffer_(0) { resetBuffer(buf); } diff --git a/src/insets/InsetLabel.cpp b/src/insets/InsetLabel.cpp index 553c6d7b96..f4a6f08eb6 100644 --- a/src/insets/InsetLabel.cpp +++ b/src/insets/InsetLabel.cpp @@ -109,11 +109,13 @@ void InsetLabel::updateLabelAndRefs(docstring const & new_label, void InsetLabel::updateReferences(docstring const & old_label, docstring const & new_label) { + UndoGroupHelper ugh; Buffer::References const & refs = buffer().references(old_label); Buffer::References::const_iterator it = refs.begin(); Buffer::References::const_iterator end = refs.end(); for (; it != end; ++it) { - buffer().undo().recordUndo(CursorData(it->second)); + ugh.resetBuffer(it->second.buffer()); + it->second.buffer()->undo().recordUndo(CursorData(it->second)); if (it->first->lyxCode() == MATH_REF_CODE) { InsetMathRef * mi = it->first->asInsetMath()->asRefInset(); mi->changeTarget(new_label); diff --git a/status.22x b/status.22x index e5ee170235..cb2ba55f55 100644 --- a/status.22x +++ b/status.22x @@ -84,6 +84,8 @@ What's new - Avoid crash when selecting long text (bug 10324). +- Fix crash with undo and child documents (bug 10643). + - Remove duplicate entries from the Symbols dialog (bug 10644). - Always show the float type in the float inset label (bug 10618).