I'd rather not just restore the setBuffer calls, since doing so means going through the entire document and setting every single inset's buffer_ member every time we call updateLabels(), which just seems excessive. So I instead propose the attached. The action here is in the addition of another optional argument to updateLabels(), which indicates whether to do the buffer_ setting, but I've also change the existing argument to an enum, just for clarity.
Seem OK? It does fix the crash. Richard
Index: insets/InsetInclude.cpp =================================================================== --- insets/InsetInclude.cpp (revision 28753) +++ insets/InsetInclude.cpp (working copy) @@ -952,7 +952,7 @@ { Buffer const * const childbuffer = getChildBuffer(buffer()); if (childbuffer) { - childbuffer->updateLabels(true); + childbuffer->updateLabels(Buffer::UpdateChildOnly); return; } if (!isListings(params())) Index: Buffer.h =================================================================== --- Buffer.h (revision 28753) +++ Buffer.h (working copy) @@ -476,9 +476,17 @@ void setInsetLabel(docstring const & label, InsetLabel const * il); InsetLabel const * insetLabel(docstring const & label) const; + enum ChildOnly { + UpdateMaster, + UpdateChildOnly + }; + enum SetInsetBuffers { + SetBuffers, + SkipBuffers + }; // FIXME: buf should should be const because updateLabels() modifies // the contents of the paragraphs. - void updateLabels(bool childonly = false) const; + void updateLabels(ChildOnly = UpdateMaster, SetInsetBuffers = SkipBuffers) const; /// void updateLabels(ParIterator & parit) const; Index: frontends/qt4/GuiInfo.cpp =================================================================== --- frontends/qt4/GuiInfo.cpp (revision 28753) +++ frontends/qt4/GuiInfo.cpp (working copy) @@ -99,7 +99,7 @@ dispatch(FuncRequest(LFUN_INSET_MODIFY, argument)); // FIXME: update the inset contents - bufferview()->buffer().updateLabels(false); + bufferview()->buffer().updateLabels(); BufferView * bv = const_cast<BufferView *>(bufferview()); bv->updateMetrics(); bv->buffer().changed(); Index: Undo.cpp =================================================================== --- Undo.cpp (revision 28753) +++ Undo.cpp (working copy) @@ -427,7 +427,7 @@ doTextUndoOrRedo(cur, stack, otherstack); // Addapt the new material to current buffer. - buffer_.updateLabels(); + buffer_.updateLabels(Buffer::UpdateMaster, Buffer::SetBuffers); return true; } Index: Buffer.cpp =================================================================== --- Buffer.cpp (revision 28753) +++ Buffer.cpp (working copy) @@ -2729,7 +2729,7 @@ } -void Buffer::updateLabels(bool childonly) const +void Buffer::updateLabels(ChildOnly co, SetInsetBuffers sib) const { // Use the master text class also for child documents Buffer const * const master = masterBuffer(); @@ -2739,11 +2739,11 @@ // master comes back we can see which of them were actually seen (i.e. // via an InsetInclude). The remaining ones in the set need still be updated. static std::set<Buffer const *> bufToUpdate; - if (!childonly) { + if (co == UpdateMaster) { // If this is a child document start with the master if (master != this) { bufToUpdate.insert(this); - master->updateLabels(false); + master->updateLabels(); // Do this here in case the master has no gui associated with it. Then, // the TocModel is not updated and TocModel::toc_ is invalid (bug 5699). if (!master->gui_) @@ -2763,6 +2763,8 @@ // update all caches clearReferenceCache(); + if (sib == SetBuffers) + inset().setBuffer(const_cast<Buffer &>(*this)); updateMacros(); Buffer & cbuf = const_cast<Buffer &>(*this); @@ -2778,7 +2780,7 @@ return; cbuf.tocBackend().update(); - if (!childonly) + if (co == UpdateMaster) cbuf.structureChanged(); }