X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FBuffer.cpp;h=c4ce8ea053d45633e4ace7f8f3c4463e26047b14;hb=80983a35535753992ab1499e2230592063f6ddcb;hp=9c42b07e7f06c82193cbf9ecbefd604cd3aef456;hpb=e9c9ad805595b50aa311d6ac2498386a3debb883;p=lyx.git diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 9c42b07e7f..c4ce8ea053 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -538,10 +538,10 @@ Buffer::~Buffer() for (; it != end; ++it) { Buffer * child = const_cast(it->first); if (theBufferList().isLoaded(child)) { - if (theBufferList().isOthersChild(this, child)) - child->setParent(0); - else - theBufferList().release(child); + if (theBufferList().isOthersChild(this, child)) + child->setParent(0); + else + theBufferList().release(child); } } @@ -3720,8 +3720,12 @@ void Buffer::listMacroNames(MacroNameSet & macros) const // loop over children Impl::BufferPositionMap::iterator it = d->children_positions.begin(); Impl::BufferPositionMap::iterator end = d->children_positions.end(); - for (; it != end; ++it) - it->first->listMacroNames(macros); + for (; it != end; ++it) { + Buffer * child = const_cast(it->first); + // The buffer might have been closed (see #10766). + if (theBufferList().isLoaded(child)) + child->listMacroNames(macros); + } // call parent Buffer const * const pbuf = d->parent();