Fix crash on recursive include (bug #8994)

The problem was that collectBibKeys() was called before the recursive include
check was done. Now collectBibKeys() works even for recursive includes, and
your get a proper error message if you try to change the file name to the
parent file.
This commit is contained in:
Georg Baum 2014-02-23 12:33:15 +01:00
parent 418d4c02d2
commit 52072b9b4e

View File

@ -407,7 +407,9 @@ Buffer * InsetInclude::getChildBuffer() const
{ {
Buffer * childBuffer = loadIfNeeded(); Buffer * childBuffer = loadIfNeeded();
// FIXME: recursive includes // FIXME RECURSIVE INCLUDE
// This isn't sufficient, as the inclusion could be downstream.
// But it'll have to do for now.
return (childBuffer == &buffer()) ? 0 : childBuffer; return (childBuffer == &buffer()) ? 0 : childBuffer;
} }
@ -972,6 +974,11 @@ void InsetInclude::collectBibKeys(InsetIterator const & /*di*/) const
Buffer * child = loadIfNeeded(); Buffer * child = loadIfNeeded();
if (!child) if (!child)
return; return;
// FIXME RECURSIVE INCLUDE
// This isn't sufficient, as the inclusion could be downstream.
// But it'll have to do for now.
if (child == &buffer())
return;
child->collectBibKeys(); child->collectBibKeys();
} }