So this didn't work (segfault). But if we're to do fillWithBibKeys()
from updateBuffer(),
something like it has to be done. I.e., we will not have an
InsetIterator at this point.
Modified: lyx-devel/trunk/src/insets/InsetBibitem.cpp
==============================================================================
--- lyx-devel/trunk/src/insets/InsetBibitem.cpp Mon Aug 9 19:33:43 2010
(r35105)
+++ lyx-devel/trunk/src/insets/InsetBibitem.cpp Mon Aug 9 20:00:46 2010
(r35106)
@@ -258,11 +258,17 @@
}
-void InsetBibitem::fillWithBibKeys(BiblioInfo& keys, InsetIterator const&
it) const
+void InsetBibitem::fillWithBibKeys(BiblioInfo& keys) const
{
docstring const key = getParam("key");
+ // false means it's not BibTeX
BibTeXInfo keyvalmap(false);
keyvalmap.label(bibLabel());
+ // The indirection here is a little annoying, but
+ // DocIterator(Buffer *, Inset *)
+ // is private.
+ InsetBibitem& me = const_cast<InsetBibitem&>(*this);
+ InsetIterator it(me);
DocIterator doc_it(it);
doc_it.forwardPos();
This causes a crash, because doc_it seems not to be properly initialized
or something.
What's weird is that when it was called like this:
it->fillWithBibKeys(d->bibinfo_, it)
it was fine. So the doc_it constructed here is not equivalent to the one
we get from the
code in Buffer::checkBibinfoCache().
keyvalmap[from_ascii("ref")] = doc_it.paragraph().asString();
So how can I get access to this paragraph if I don't have the InsetIterator?
Richard