André, if I have a math inset that contains sub-insets (fractions, macros etc) then leaving any one of these sub-insets causes a new preview to be generated. I believe that the solution is to check that we're leaving the InsetFormula itself and that the appropriate fix is:
void MathNestInset::notifyCursorLeaves() { - //lyxerr << "leaving " << *this << "\n"; - if (!mathcursor || !grfx::Previews::activated()) + if (!mathcursor || !grfx::Previews::activated() || + mathcursor->depth() != 1) return; InsetFormulaBase * inset = mathcursor->formula(); BufferView * bufferview = inset->view(); if (!bufferview || !bufferview->buffer()) return; grfx::Previews & previews = grfx::Previews::get(); grfx::PreviewLoader & loader = previews.loader(bufferview->buffer()); inset->generatePreview(loader); loader.startLoading(); } It seems to work, but Is It Right? Angus ps. Hope the talk went well.