]> git.lyx.org Git - lyx.git/blobdiff - src/Buffer.cpp
Do not forget to set cursor current font when selecting
[lyx.git] / src / Buffer.cpp
index 9c42b07e7f06c82193cbf9ecbefd604cd3aef456..c4ce8ea053d45633e4ace7f8f3c4463e26047b14 100644 (file)
@@ -538,10 +538,10 @@ Buffer::~Buffer()
                for (; it != end; ++it) {
                        Buffer * child = const_cast<Buffer *>(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<Buffer *>(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();