From Andre, earlier:
Problems can be solved by the following recipe:
The LyX code 2 in the error can be 'translated' by using insets/InsetCode.h
into 'QUOTE_CODE', and
[EMAIL PROTECTED]:/data/lyx/trunk > g 'new InsetQuote'
src/Text3.cpp: cur.insert(new InsetQuotes(c,
src/Text3.cpp: cur.insert(new InsetQuotes(c,
src/insets/InsetQuotes.cpp: return new InsetQuotes(language_, side_,
times_);
src/factory.cpp: inset.reset(new InsetQuotes);
nicely points to the problem areas: The use in factory.cpp is fine. In
InsetQuotes.cpp should use the canonical form
Inset * InsetQuotes::clone() const
{
//return new InsetQuotes(language_, side_, times_); // NOT!
return new InsetQuotes(*this);
}
and the two calls in Text3.cpp should use the inset factory (preferably)
or call ->setBuffer(...) manually as "Hotfix" (less preferable).
Andre: What did you mean by "use the inset factory"? Do you mean call
createInset()? If so, what's the preferred way to generate the FuncRequest?
If anyone wants to check some things, see the following. I think I've
fixed all the clone() calls, including ones that weren't causing
problems. It just seems best to be safe, as if we don't fix it, a change
in the Inset could later cause a crash. Someone should check
InsetTabular---I don't know my way around that code. And I'm guessing
that the Text*.cpp calls need attention.
[EMAIL PROTECTED] src]$ for i in insets/Inset*.h; do j=${i#insets/};
j=${j%.h}; srcgrep new $j | grep -v factory.cpp; done | sort | uniq
Cursor.cpp:1006: insert(new InsetMathChar(c));
CutAndPaste.cpp:781: InsetGraphics * inset = new InsetGraphics;
insets/InsetBibitem.h:59: virtual Inset * clone() const { return
new InsetBibitem(*this); }
insets/InsetBibtex.cpp:71: return new InsetBibtex(*this);
insets/InsetBox.cpp:109: return new InsetBox(*this);
insets/InsetBranch.cpp:55: return new InsetBranch(*this);
insets/InsetCaption.cpp:311: return new InsetCaption(*this);
insets/InsetCitation.h:60: Inset * clone() const { return new
InsetCitation(*this); }
insets/InsetEnvironment.cpp:44: return new InsetEnvironment(*this);
insets/InsetERT.cpp:58: return new InsetERT(*this);
insets/InsetExternal.cpp:423: return new InsetExternal(*this);
insets/InsetFlex.cpp:60: return new InsetFlex(*this);
insets/InsetFloat.cpp:273: return new InsetFloat(*this);
insets/InsetFloatList.h:58: { return new
InsetFloatList(to_ascii(getParam("type"))); }
insets/InsetFoot.cpp:50: return new InsetFoot(*this);
insets/InsetGraphics.cpp:148: return new InsetGraphics(*this);
insets/InsetHFill.cpp:42: return new InsetHFill;
insets/InsetHyperlink.h:58: Inset * clone() const { return new
InsetHyperlink(params()); }
insets/InsetInclude.cpp:255: return new InsetInclude(*this);
insets/InsetIndex.cpp:53: return new InsetIndex(*this);
insets/InsetIndex.h:74: Inset * clone() const { return new
InsetPrintIndex(params()); }
insets/InsetInfo.cpp:229:
info.insertInset(0, new InsetSpecialChar(InsetSpecialChar::MENU_SEPARATOR),
insets/InsetInfo.h:113: virtual Inset * clone() const { return new
InsetInfo(*this); }
insets/InsetLabel.h:52: Inset * clone() const { return new
InsetLabel(*this); }
insets/InsetLine.h:48: Inset * clone() const { return new
InsetLine(*this); }
insets/InsetListings.cpp:56: return new InsetListings(*this);
insets/InsetMarginal.cpp:40: return new InsetMarginal(*this);
insets/InsetNewline.h:57: Inset * clone() const { return new
InsetNewline(*this); }
insets/InsetNewline.h:73: virtual Inset * clone() const { return
new InsetLinebreak(*this); }
insets/InsetNewpage.h:53: Inset * clone() const { return new
InsetNewpage(*this); }
insets/InsetNewpage.h:68: virtual Inset * clone() const { return
new InsetPagebreak(*this); }
insets/InsetNewpage.h:81: virtual Inset * clone() const { return
new InsetClearPage(*this); }
insets/InsetNewpage.h:94: virtual Inset * clone() const { return
new InsetClearDoublePage(*this); }
insets/InsetNomencl.h:50: Inset * clone() const { return new
InsetNomencl(*this); }
insets/InsetNomencl.h:84: Inset * clone() const { return new
InsetPrintNomencl(*this); }
insets/InsetNote.cpp:129: return new InsetNote(*this);
insets/InsetOptArg.cpp:36: return new InsetOptArg(*this);
insets/InsetQuotes.h:104: Inset * clone() const { return new
InsetQuotes(*this); }
insets/InsetRef.h:74: Inset * clone() const { return new
InsetRef(*this); }
insets/InsetSpace.h:87: virtual Inset * clone() const { return new
InsetSpace(*this); }
insets/InsetSpecialChar.h:83: Inset * clone() const { return new
InsetSpecialChar(*this); };
insets/InsetTabular.cpp:2891: return new InsetTabular(*this);
insets/InsetTabular.cpp:4586: new
InsetText(*paste_tabular->getCellInset(r1, c1)));
insets/InsetTabular.cpp:487: inset(new InsetText(buffer.params()))
insets/InsetText.cpp:149: return new InsetText(*this);
insets/InsetTheorem.cpp:57: InsetTheorem * result = new InsetTheorem;
insets/InsetTOC.cpp:47: return new InsetTOC(*this);
insets/InsetVSpace.cpp:56: return new InsetVSpace(*this);
insets/InsetWrap.cpp:204: return new InsetWrap(*this);
Paragraph.cpp:2497: InsetBibitem * inset = new
InsetBibitem(InsetCommandParams(BIBITEM_CODE));
Text2.cpp:228: Inset * inset = new InsetEnvironment(params,
layout);
Text3.cpp:1118: cur.insert(new InsetQuotes(c,
Text3.cpp:1122: cur.insert(new InsetQuotes(c,
Text3.cpp:133: cur.insert(new InsetMathHull(hullSimple));
Text3.cpp:1502: cur.insert(new InsetMathHull(hullSimple));
Text3.cpp:155: InsetMathHull * formula = new InsetMathHull;
Text3.cpp:1694: insertInset(cur, new
InsetFloatList(to_utf8(cmd.argument())));
Text3.cpp:177: cur.insert(new InsetSpecialChar(kind));
Text3.cpp:693: cur.insert(new InsetNewline);
Text3.cpp:708: cur.insert(new InsetLinebreak);
Text.cpp:220: inset.reset(new InsetSpecialChar);
Text.cpp:222: inset.reset(new InsetSpace);
Text.cpp:230: auto_ptr<Inset> inset(new InsetLinebreak);
Text.cpp:234: auto_ptr<Inset> inset(new InsetNewline);
Text.cpp:238: auto_ptr<Inset> inset(new InsetTabular(buf));
Text.cpp:242: par.insertInset(par.size(), new InsetHFill,
font, change);
Text.cpp:244: par.insertInset(par.size(), new InsetLine, font,
change);
Text.cpp:246: par.insertInset(par.size(), new InsetNewpage,
font, change);
Text.cpp:248: par.insertInset(par.size(), new InsetPagebreak,
font, change);
Text.cpp:250: par.insertInset(par.size(), new InsetClearPage,
font, change);
Text.cpp:252: par.insertInset(par.size(), new
InsetClearDoublePage, font, change);