From: Richard Heck Date: Sat, 16 Jul 2011 13:40:20 +0000 (+0000) Subject: Add check for recursive includes. X-Git-Tag: 2.1.0beta1~2906 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=1f820d11a26a156fd26dced06ea5d8b7a07896e2;p=features.git Add check for recursive includes. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39328 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 3632af200c..6c3841ba63 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -2640,6 +2640,12 @@ 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); + } }