]> git.lyx.org Git - lyx.git/blobdiff - src/BufferList.cpp
Better debug ouput
[lyx.git] / src / BufferList.cpp
index ecf7fdc4df54ca751a240d3de1b632a0e8f68bd8..f9a059b61caa801b82f935e1ba7daad7eb8d0cbd 100644 (file)
@@ -119,7 +119,7 @@ Buffer * BufferList::newBuffer(string const & s, bool const ronly)
                }
        }
        tmpbuf->params().useClassDefaults();
-       if (tmpbuf->fileName().extension() == "internal") {
+       if (tmpbuf->isInternal()) {
                binternal.push_back(tmpbuf.get());
        } else {
                LYXERR(Debug::INFO, "Assigning to buffer " << bstore.size());
@@ -232,8 +232,10 @@ bool BufferList::exists(FileName const & fname) const
 }
 
 
-bool BufferList::isLoaded(Buffer const * b) const
+ bool BufferList::isLoaded(Buffer const * b) const
 {
+       if (!b)
+               return false;
        BufferStorage::const_iterator cit =
                find(bstore.begin(), bstore.end(), b);
        return cit != bstore.end();
@@ -318,7 +320,8 @@ bool BufferList::releaseChild(Buffer * parent, Buffer * child)
        LASSERT(parent->isChild(child), return false);
 
        // Child document has a different parent, don't close it.
-       if (child->parent() != parent)
+       Buffer const * parent_ = child->parent();
+       if (parent_ && parent_ != parent)
                return false;
 
        BufferStorage::iterator it = bstore.begin();
@@ -335,4 +338,17 @@ bool BufferList::releaseChild(Buffer * parent, Buffer * child)
 }
 
 
+void BufferList::changed(bool update_metrics) const
+{
+       BufferStorage::const_iterator it = bstore.begin();
+       BufferStorage::const_iterator end = bstore.end();
+       for (; it != end; ++it)
+               (*it)->changed(update_metrics);
+       it = binternal.begin();
+       end = binternal.end();
+       for (; it != end; ++it)
+               (*it)->changed(update_metrics);
+}
+
+
 } // namespace lyx