On Thu, Mar 25, 2004 at 07:43:00PM +0000, Angus Leeming wrote: > Furthermore, there is a leak in the code above. I think the minimal > change is: > > if (from.getInset(i)) { > // the inset is not in a paragraph anymore > tmpinset = from.insetlist.release(i); > + from.insetlist.erase(i); > } > > - if (!to.insetAllowed(tmpinset->lyxCode())) > + if (!to.insetAllowed(tmpinset->lyxCode())) { > + delete tmpinset; > return false; > + } > - to.insertInset(j, tmpinset, tmpfont); > + if (tmpinset) > + to.insertInset(j, tmpinset, tmpfont); > > Ie, I think it was wrong in THREE places!
Does it still work after this change? [A simple solution would be a wrapper to an InsetBase * that provides value-semantics pretty much the way MathAtom encapsulates a MathInset. This might cost a few cycles now and then, but it would also simplify the Paragraph c'c'tor and d'tor.] Andre'