]> git.lyx.org Git - features.git/commitdiff
Fix part of bug #6251: When closing a buffer, only close the direct children. All...
authorVincent van Ravesteijn <vfr@lyx.org>
Thu, 29 Oct 2009 23:28:08 +0000 (23:28 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Thu, 29 Oct 2009 23:28:08 +0000 (23:28 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31797 a592a061-630c-0410-9148-cb99ea01b6c8

src/Buffer.cpp
src/Buffer.h
src/frontends/qt4/GuiView.cpp

index b42f14d028ff642e155f6bdc1feb7148a16b599b..34316c1a14862abfd923e555837ae4c822c47866 100644 (file)
@@ -2337,7 +2337,7 @@ DocIterator Buffer::firstChildPosition(Buffer const * child)
 }
 
 
-std::vector<Buffer *> Buffer::getChildren() const
+std::vector<Buffer *> Buffer::getChildren(bool grand_children) const
 {
        std::vector<Buffer *> clist;
        // loop over children
@@ -2346,11 +2346,13 @@ std::vector<Buffer *> Buffer::getChildren() const
        for (; it != end; ++it) {
                Buffer * child = const_cast<Buffer *>(it->first);
                clist.push_back(child);
-               // there might be grandchildren
-               std::vector<Buffer *> glist = child->getChildren();
-               for (vector<Buffer *>::const_iterator git = glist.begin();
-                    git != glist.end(); ++git)
-                       clist.push_back(*git);
+               if (grand_children) {
+                       // there might be grandchildren
+                       std::vector<Buffer *> glist = child->getChildren();
+                       for (vector<Buffer *>::const_iterator git = glist.begin();
+                                git != glist.end(); ++git)
+                               clist.push_back(*git);
+               }
        }
        return clist;
 }
index af69950eb1a74443136eac2624d64a353c617ef7..be7caa6519dda100609f249cf8e7af1e9f57481f 100644 (file)
@@ -311,8 +311,8 @@ public:
        /// \return true if \p child is a child of this \c Buffer.
        bool isChild(Buffer * child) const;
        
-       /// return a vector with all children and grandchildren
-       std::vector<Buffer *> getChildren() const;
+       /// return a vector with all children (and grandchildren)
+       std::vector<Buffer *> getChildren(bool grand_children = true) const;
 
        /// Is buffer read-only?
        bool isReadonly() const;
index d352f880c97c657b3d6a958ebdc571cea866f70c..bfbe8d2605236b59e3e393ab9b0db75f6b9f5bc4 100644 (file)
@@ -2065,7 +2065,7 @@ bool GuiView::closeBuffer(Buffer & buf)
        // in the session file in the correct order. If we close the master
        // buffer, we can close or release the child buffers here too.
        if (!closing_) {
-               vector<Buffer *> clist = buf.getChildren();
+               vector<Buffer *> clist = buf.getChildren(false);
                for (vector<Buffer *>::const_iterator it = clist.begin();
                         it != clist.end(); ++it) {
                        // If a child is dirty, do not close