]> git.lyx.org Git - lyx.git/blobdiff - src/BufferList.cpp
Fix #10778 (issue with CJK and language nesting)
[lyx.git] / src / BufferList.cpp
index ff99a090f35ea08ad398bbb8eabaf1ca92ef9238..bcdec59d87cf9e34cf800c0afbcfe61836a550ea 100644 (file)
@@ -98,10 +98,15 @@ void BufferList::release(Buffer * buf)
        BufferStorage::iterator const it =
                find(bstore.begin(), bstore.end(), buf);
        if (it != bstore.end()) {
+               Buffer const * parent = buf->parent();
                Buffer * tmp = (*it);
                bstore.erase(it);
                LASSERT(tmp, return);
                delete tmp;
+               if (parent)
+                       // If this was a child, update the parent's buffer
+                       // to avoid crashes due to dangling pointers (bug 9979)
+                       parent->updateBuffer();
        }
 }
 
@@ -251,6 +256,15 @@ void BufferList::emergencyWriteAll()
 }
 
 
+void BufferList::invalidateConverterCache() const
+{
+       BufferStorage::const_iterator it = bstore.begin();
+       BufferStorage::const_iterator const en = bstore.end();
+       for (; it != en; ++it)
+               (*it)->params().invalidateConverterCache();
+}
+
+
 bool BufferList::exists(FileName const & fname) const
 {
        return getBuffer(fname) != 0;