]> git.lyx.org Git - features.git/commitdiff
Fix recursive include check.
authorRichard Heck <rgheck@comcast.net>
Mon, 18 Jul 2011 13:57:15 +0000 (13:57 +0000)
committerRichard Heck <rgheck@comcast.net>
Mon, 18 Jul 2011 13:57:15 +0000 (13:57 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39339 a592a061-630c-0410-9148-cb99ea01b6c8

src/Buffer.cpp

index 6c3841ba638ee1941effd418265a999564c4107f..df5811c8f0abb1c8d0425a3e6f01f6a31244007c 100644 (file)
@@ -2640,12 +2640,6 @@ void Buffer::collectChildren(ListOfBuffers & clist, bool grand_children) const
                        // there might be grandchildren
                        child->collectChildren(clist, true);
        }
-       // Make sure we have not included ourselves.
-       ListOfBuffers::iterator bit = find(clist.begin(), clist.end(), this);
-       if (bit != clist.end()) {
-               LYXERR0("Recursive include detected in `" << fileName() << "'.");
-               clist.erase(bit);
-       }
 }
 
 
@@ -2653,6 +2647,12 @@ ListOfBuffers Buffer::getChildren() const
 {
        ListOfBuffers v;
        collectChildren(v, false);
+       // Make sure we have not included ourselves.
+       ListOfBuffers::iterator bit = find(v.begin(), v.end(), this);
+       if (bit != v.end()) {
+               LYXERR0("Recursive include detected in `" << fileName() << "'.");
+               v.erase(bit);
+       }
        return v;
 }
 
@@ -2661,6 +2661,12 @@ ListOfBuffers Buffer::getDescendents() const
 {
        ListOfBuffers v;
        collectChildren(v, true);
+       // Make sure we have not included ourselves.
+       ListOfBuffers::iterator bit = find(v.begin(), v.end(), this);
+       if (bit != v.end()) {
+               LYXERR0("Recursive include detected in `" << fileName() << "'.");
+               v.erase(bit);
+       }
        return v;
 }