Andre Poenitz wrote:
Of course, there may be other issues elsewhere, and you would know better than I. I suppose I could start by doing this sort of thing to InsetText and InsetCommand.

Yep, just do it ;-)

Unfortunately, this does run into huge problems in the end, at least for InsetCommand. The source of the problem is here:
void InsetMathHull::label(row_type row, docstring const & label)
{
//lyxerr << "setting label '" << label << "' for row " << row << endl;
if (label_[row]) {
if (label.empty()) {
delete label_[row];
label_[row] = dummy_pointer;
} else
label_[row]->updateCommand(label);
return;
}
InsetCommandParams p(LABEL_CODE);
p["name"] = label;
label_[row] = new InsetLabel(p);
if (buffer_)
label_[row]->setBuffer(buffer());
}
If InsetLabel has to have a Buffer, then buffer_ has to be set, which means InsetMathHull needs a Buffer. But then truckloads of these are created in Parser, where we don't really seem to have access to a Buffer---as well you know, since you wrote all of that stuff. Maybe it could be given one: we are presumably parsing stuff for a Buffer. But then it looks as if that means all the InsetMath stuff will need a Buffer, since so many of them call the parser somewhere or other. Anyway, that is code I don't know at all, so I'm not about to mess with it.

That said, it's clear from my explorations that this code does create InsetLabels that have no Buffer. (I put an assertion in there to see.) Whether there are crashes lurking here, I do not know.

I'm attaching a patch that works except for this issue. The "if (buffer_)" line in the above is a BOOST_ASSERT in the patch. Just open the Math or Embedded Objects manual to trigger it.

Maybe I'll try InsetText.

Richard

Index: src/factory.cpp
===================================================================
--- src/factory.cpp	(revision 23957)
+++ src/factory.cpp	(working copy)
@@ -142,7 +142,7 @@
 			return new InsetOptArg(buf);
 
 		case LFUN_BIBITEM_INSERT:
-			return new InsetBibitem(InsetCommandParams(BIBITEM_CODE));
+			return new InsetBibitem(buf, InsetCommandParams(BIBITEM_CODE));
 
 		case LFUN_FLOAT_INSERT: {
 			// check if the float type exists
@@ -178,7 +178,7 @@
 		case LFUN_NOMENCL_INSERT: {
 			InsetCommandParams icp(NOMENCL_CODE);
 			icp["symbol"] = cmd.argument();
-			return new InsetNomencl(icp);
+			return new InsetNomencl(buf, icp);
 		}
 
 		case LFUN_TABULAR_INSERT: {
@@ -198,13 +198,13 @@
 			return new InsetCaption(buf);
 
 		case LFUN_INDEX_PRINT:
-			return new InsetPrintIndex(InsetCommandParams(INDEX_PRINT_CODE));
+			return new InsetPrintIndex(buf, InsetCommandParams(INDEX_PRINT_CODE));
 
 		case LFUN_NOMENCL_PRINT:
-			return new InsetPrintNomencl(InsetCommandParams(NOMENCL_PRINT_CODE));
+			return new InsetPrintNomencl(buf, InsetCommandParams(NOMENCL_PRINT_CODE));
 
 		case LFUN_TOC_INSERT:
-			return new InsetTOC(InsetCommandParams(TOC_CODE));
+			return new InsetTOC(buf, InsetCommandParams(TOC_CODE));
 
 		case LFUN_ENVIRONMENT_INSERT:
 			return new InsetEnvironment(buf, cmd.argument());
@@ -223,19 +223,19 @@
 			case BIBITEM_CODE: {
 				InsetCommandParams icp(code);
 				InsetCommandMailer::string2params(name, to_utf8(cmd.argument()), icp);
-				return new InsetBibitem(icp);
+				return new InsetBibitem(buf, icp);
 			}
 			
 			case BIBTEX_CODE: {
 				InsetCommandParams icp(code);
 				InsetCommandMailer::string2params(name, to_utf8(cmd.argument()), icp);
-				return new InsetBibtex(icp);
+				return new InsetBibtex(buf, icp);
 			}
 			
 			case CITE_CODE: {
 				InsetCommandParams icp(code);
 				InsetCommandMailer::string2params(name, to_utf8(cmd.argument()), icp);
-				return new InsetCitation(icp);
+				return new InsetCitation(buf, icp);
 			}
 			
 			case ERT_CODE: {
@@ -270,13 +270,13 @@
 			case HYPERLINK_CODE: {
 				InsetCommandParams icp(code);
 				InsetCommandMailer::string2params(name, to_utf8(cmd.argument()), icp);
-				return new InsetHyperlink(icp);
+				return new InsetHyperlink(buf, icp);
 			}
 			
 			case INCLUDE_CODE: {
 				InsetCommandParams icp(code);
 				InsetCommandMailer::string2params(name, to_utf8(cmd.argument()), icp);
-				return new InsetInclude(icp);
+				return new InsetInclude(buf, icp);
 			}
 			
 			case INDEX_CODE:
@@ -285,13 +285,13 @@
 			case NOMENCL_CODE: {
 				InsetCommandParams icp(code);
 				InsetCommandMailer::string2params(name, lyx::to_utf8(cmd.argument()), icp);
-				return new InsetNomencl(icp);
+				return new InsetNomencl(buf, icp);
 			}
 			
 			case LABEL_CODE: {
 				InsetCommandParams icp(code);
 				InsetCommandMailer::string2params(name, to_utf8(cmd.argument()), icp);
-				return new InsetLabel(icp);
+				return new InsetLabel(buf, icp);
 			}
 			
 			case REF_CODE: {
@@ -309,7 +309,7 @@
 			case TOC_CODE: {
 				InsetCommandParams icp(code);
 				InsetCommandMailer::string2params(name, to_utf8(cmd.argument()), icp);
-				return new InsetTOC(icp);
+				return new InsetTOC(buf, icp);
 			}
 			
 			case VSPACE_CODE: {
@@ -449,38 +449,38 @@
 
 		switch (code) {
 			case BIBITEM_CODE:
-				inset.reset(new InsetBibitem(inscmd));
+				inset.reset(new InsetBibitem(buf, inscmd));
 				break;
 			case BIBTEX_CODE:
-				inset.reset(new InsetBibtex(inscmd));
+				inset.reset(new InsetBibtex(buf, inscmd));
 				break;
 			case CITE_CODE: 
-				inset.reset(new InsetCitation(inscmd));
+				inset.reset(new InsetCitation(buf, inscmd));
 				break;
 			case HYPERLINK_CODE:
-				inset.reset(new InsetHyperlink(inscmd));
+				inset.reset(new InsetHyperlink(buf, inscmd));
 				break;
 			case INCLUDE_CODE:
-				inset.reset(new InsetInclude(inscmd));
+				inset.reset(new InsetInclude(buf, inscmd));
 				break;
 			case INDEX_PRINT_CODE:
-				inset.reset(new InsetPrintIndex(inscmd));
+				inset.reset(new InsetPrintIndex(buf, inscmd));
 				break;
 			case LABEL_CODE:
-				inset.reset(new InsetLabel(inscmd));
+				inset.reset(new InsetLabel(buf, inscmd));
 				break;
 			case NOMENCL_CODE:
-				inset.reset(new InsetNomencl(inscmd));
+				inset.reset(new InsetNomencl(buf, inscmd));
 				break;
 			case NOMENCL_PRINT_CODE:
-				inset.reset(new InsetPrintNomencl(inscmd));
+				inset.reset(new InsetPrintNomencl(buf, inscmd));
 				break;
 			case REF_CODE:
 				if (!inscmd["name"].empty() || !inscmd["reference"].empty())
 					inset.reset(new InsetRef(buf, inscmd));
 				break;
 			case TOC_CODE:
-				inset.reset(new InsetTOC(inscmd));
+				inset.reset(new InsetTOC(buf, inscmd));
 				break;
 			case NO_CODE:
 			default:
@@ -490,7 +490,6 @@
 					lex.next();
 				return 0;
 		}
-		inset->setBuffer(const_cast<Buffer &>(buf));
 	} else { 
 		// FIXME This branch should be made to use inset codes as the preceding 
 		// branch does. Unfortunately, that will take some doing. It requires
@@ -505,7 +504,7 @@
 		} else if (tmptok == "FormulaMacro") {
 			inset.reset(new MathMacroTemplate);
 		} else if (tmptok == "Formula") {
-			inset.reset(new InsetMathHull);
+			inset.reset(new InsetMathHull());
 		} else if (tmptok == "Graphics") {
 			inset.reset(new InsetGraphics(const_cast<Buffer &>(buf)));
 		} else if (tmptok == "Note") {
@@ -560,7 +559,7 @@
 		} else if (tmptok == "Index") {
 			inset.reset(new InsetIndex(buf));
 		} else if (tmptok == "FloatList") {
-			inset.reset(new InsetFloatList);
+			inset.reset(new InsetFloatList(buf));
 		} else if (tmptok == "Info") {
 			inset.reset(new InsetInfo(buf));
 		} else {
Index: src/insets/InsetBibitem.cpp
===================================================================
--- src/insets/InsetBibitem.cpp	(revision 23957)
+++ src/insets/InsetBibitem.cpp	(working copy)
@@ -47,8 +47,8 @@
 docstring const key_prefix = from_ascii("key-");
 
 
-InsetBibitem::InsetBibitem(InsetCommandParams const & p)
-	: InsetCommand(p, "bibitem")
+InsetBibitem::InsetBibitem(Buffer const & buf, InsetCommandParams const & p)
+	: InsetCommand(buf, p, "bibitem")
 {
 	if (getParam("key").empty())
 		setParam("key", key_prefix + convert<docstring>(++key_counter));
Index: src/insets/InsetBibitem.h
===================================================================
--- src/insets/InsetBibitem.h	(revision 23957)
+++ src/insets/InsetBibitem.h	(working copy)
@@ -27,7 +27,7 @@
 class InsetBibitem : public InsetCommand {
 public:
 	///
-	InsetBibitem(InsetCommandParams const &);
+	InsetBibitem(Buffer const &, InsetCommandParams const &);
 	/// verify label and update references.
 	/**
 	  * Overloaded from Inset::initView.
Index: src/insets/InsetBibtex.cpp
===================================================================
--- src/insets/InsetBibtex.cpp	(revision 23957)
+++ src/insets/InsetBibtex.cpp	(working copy)
@@ -47,8 +47,8 @@
 namespace os = support::os;
 
 
-InsetBibtex::InsetBibtex(InsetCommandParams const & p)
-	: InsetCommand(p, "bibtex"), bibfiles_()
+InsetBibtex::InsetBibtex(Buffer const & buf, InsetCommandParams const & p)
+	: InsetCommand(buf, p, "bibtex"), bibfiles_()
 {}
 
 
Index: src/insets/InsetBibtex.h
===================================================================
--- src/insets/InsetBibtex.h	(revision 23957)
+++ src/insets/InsetBibtex.h	(working copy)
@@ -25,7 +25,7 @@
 class InsetBibtex : public InsetCommand {
 public:
 	///
-	InsetBibtex(InsetCommandParams const &);
+	InsetBibtex(Buffer const & buf, InsetCommandParams const &);
 	///
 	void setBuffer(Buffer & buffer);
 	///
Index: src/insets/InsetCitation.cpp
===================================================================
--- src/insets/InsetCitation.cpp	(revision 23957)
+++ src/insets/InsetCitation.cpp	(working copy)
@@ -381,8 +381,9 @@
 ParamInfo InsetCitation::param_info_;
 
 
-InsetCitation::InsetCitation(InsetCommandParams const & p)
-	: InsetCommand(p, "citation")
+InsetCitation::InsetCitation(Buffer const & buf, 
+		InsetCommandParams const & p)
+	: InsetCommand(buf, p, "citation")
 {}
 
 
Index: src/insets/InsetCitation.h
===================================================================
--- src/insets/InsetCitation.h	(revision 23957)
+++ src/insets/InsetCitation.h	(working copy)
@@ -28,7 +28,7 @@
 class InsetCitation : public InsetCommand {
 public:
 	///
-	InsetCitation(InsetCommandParams const &);
+	InsetCitation(Buffer const &, InsetCommandParams const &);
 	///
 	bool isLabeled() const { return true; }
 	///
Index: src/insets/InsetCommand.cpp
===================================================================
--- src/insets/InsetCommand.cpp	(revision 23957)
+++ src/insets/InsetCommand.cpp	(working copy)
@@ -31,12 +31,14 @@
 
 // FIXME Would it now be possible to use the InsetCode in 
 // place of the mailer name and recover that information?
-InsetCommand::InsetCommand(InsetCommandParams const & p,
-			   string const & mailer_name)
+InsetCommand::InsetCommand(Buffer const & buf, 
+		InsetCommandParams const & p, string const & mailer_name)
 	: p_(p),
 	  mailer_name_(mailer_name),
 	  mouse_hover_(false)
-{}
+{
+	Inset::setBuffer(const_cast<Buffer &>(buf));
+}
 
 
 InsetCommand::~InsetCommand()
Index: src/insets/InsetCommand.h
===================================================================
--- src/insets/InsetCommand.h	(revision 23957)
+++ src/insets/InsetCommand.h	(working copy)
@@ -31,7 +31,8 @@
 class InsetCommand : public Inset {
 public:
 	///
-	InsetCommand(InsetCommandParams const &, std::string const & mailer_name);
+	InsetCommand(Buffer const &, InsetCommandParams const &, 
+		std::string const & mailer_name);
 	///
 	~InsetCommand();
 	///
Index: src/insets/InsetFloatList.cpp
===================================================================
--- src/insets/InsetFloatList.cpp	(revision 23957)
+++ src/insets/InsetFloatList.cpp	(working copy)
@@ -36,13 +36,13 @@
 namespace lyx {
 
 
-InsetFloatList::InsetFloatList()
-	: InsetCommand(InsetCommandParams(FLOAT_LIST_CODE), "toc")
+InsetFloatList::InsetFloatList(Buffer const & buf)
+	: InsetCommand(buf, InsetCommandParams(FLOAT_LIST_CODE), "toc")
 {}
 
 
-InsetFloatList::InsetFloatList(string const & type)
-	: InsetCommand(InsetCommandParams(FLOAT_LIST_CODE), "toc")
+InsetFloatList::InsetFloatList(Buffer const & buf, string const & type)
+	: InsetCommand(buf ,InsetCommandParams(FLOAT_LIST_CODE), "toc")
 {
 	setParam("type", from_ascii(type));
 }
Index: src/insets/InsetFloatList.h
===================================================================
--- src/insets/InsetFloatList.h	(revision 23957)
+++ src/insets/InsetFloatList.h	(working copy)
@@ -23,9 +23,9 @@
 class InsetFloatList : public InsetCommand {
 public:
 	///
-	InsetFloatList();
+	InsetFloatList(Buffer const &);
 	///
-	InsetFloatList(std::string const & type);
+	InsetFloatList(Buffer const &, std::string const & type);
 	///
 	docstring screenLabel() const;
 	///
@@ -55,7 +55,7 @@
 private:
 	///
 	virtual Inset * clone() const
-		{ return new InsetFloatList(to_ascii(getParam("type"))); }
+		{ return new InsetFloatList(buffer(), to_ascii(getParam("type"))); }
 	///
 	static ParamInfo param_info_;
 };
Index: src/insets/InsetHyperlink.cpp
===================================================================
--- src/insets/InsetHyperlink.cpp	(revision 23957)
+++ src/insets/InsetHyperlink.cpp	(working copy)
@@ -28,8 +28,9 @@
 namespace lyx {
 
 
-InsetHyperlink::InsetHyperlink(InsetCommandParams const & p)
-	: InsetCommand(p, "href")
+InsetHyperlink::InsetHyperlink(Buffer const & buf, 
+		InsetCommandParams const & p)
+	: InsetCommand(buf, p, "href")
 {}
 
 
Index: src/insets/InsetHyperlink.h
===================================================================
--- src/insets/InsetHyperlink.h	(revision 23957)
+++ src/insets/InsetHyperlink.h	(working copy)
@@ -26,7 +26,7 @@
 public:
 	///
 	explicit
-	InsetHyperlink(InsetCommandParams const &);
+	InsetHyperlink(Buffer const &, InsetCommandParams const &);
 	///
 	InsetCode lyxCode() const { return HYPERLINK_CODE; }
 	///
@@ -55,7 +55,7 @@
 	/// Force inset into LTR environment if surroundings are RTL?
 	bool forceLTR() const { return true; }
 private:
-	Inset * clone() const { return new InsetHyperlink(params()); }
+	Inset * clone() const { return new InsetHyperlink(buffer(), params()); }
 };
 
 
Index: src/insets/InsetInclude.cpp
===================================================================
--- src/insets/InsetInclude.cpp	(revision 23957)
+++ src/insets/InsetInclude.cpp	(working copy)
@@ -150,20 +150,11 @@
 	return file;
 }
 
-InsetLabel * createLabel(docstring const & label_str)
-{
-	if (label_str.empty())
-		return 0;
-	InsetCommandParams icp(LABEL_CODE);
-	icp["name"] = label_str;
-	return new InsetLabel(icp);
-}
-
 } // namespace anon
 
 
-InsetInclude::InsetInclude(InsetCommandParams const & p)
-	: InsetCommand(p, "include"), include_label(uniqueID()),
+InsetInclude::InsetInclude(Buffer const & buf, InsetCommandParams const & p)
+	: InsetCommand(buf, p, "include"), include_label(uniqueID()),
 	  preview_(new RenderMonitoredPreview(this)), set_label_(false), label_(0)
 {
 	preview_->fileChanged(boost::bind(&InsetInclude::fileChanged, this));
@@ -214,6 +205,16 @@
 }
 
 
+InsetLabel * InsetInclude::createLabel(docstring const & label_str)
+{
+	if (label_str.empty())
+		return 0;
+	InsetCommandParams icp(LABEL_CODE);
+	icp["name"] = label_str;
+	return new InsetLabel(buffer(), icp);
+}
+
+
 void InsetInclude::setBuffer(Buffer & buffer)
 {
 	if (buffer_) {
Index: src/insets/InsetInclude.h
===================================================================
--- src/insets/InsetInclude.h	(revision 23957)
+++ src/insets/InsetInclude.h	(working copy)
@@ -35,10 +35,11 @@
 class InsetInclude : public InsetCommand {
 public:
 	///
-	InsetInclude(InsetCommandParams const &);
+	InsetInclude(Buffer const &, InsetCommandParams const &);
 	~InsetInclude();
-
+	///
 	void setBuffer(Buffer & buffer);
+	///
 	bool isLabeled() const { return true; }
 
 	/// Override these InsetButton methods if Previewing
@@ -108,6 +109,8 @@
 	 */
 	void fileChanged() const;
 
+	///
+	InsetLabel * createLabel(docstring const & label_str);
 	/// set the parameters
 	void setParams(InsetCommandParams const & params);
 	/// get the text displayed on the button
Index: src/insets/InsetIndex.cpp
===================================================================
--- src/insets/InsetIndex.cpp	(revision 23957)
+++ src/insets/InsetIndex.cpp	(working copy)
@@ -74,8 +74,9 @@
 //
 ///////////////////////////////////////////////////////////////////////
 
-InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p)
-	: InsetCommand(p, string())
+InsetPrintIndex::InsetPrintIndex(Buffer const & buf, 
+		InsetCommandParams const & p)
+	: InsetCommand(buf, p, string())
 {}
 
 
Index: src/insets/InsetIndex.h
===================================================================
--- src/insets/InsetIndex.h	(revision 23957)
+++ src/insets/InsetIndex.h	(working copy)
@@ -48,7 +48,7 @@
 class InsetPrintIndex : public InsetCommand {
 public:
 	///
-	InsetPrintIndex(InsetCommandParams const &);
+	InsetPrintIndex(Buffer const &, InsetCommandParams const &);
 
 	///
 	static ParamInfo const & findInfo(std::string const &);
Index: src/insets/InsetLabel.cpp
===================================================================
--- src/insets/InsetLabel.cpp	(revision 23957)
+++ src/insets/InsetLabel.cpp	(working copy)
@@ -38,8 +38,8 @@
 namespace lyx {
 
 
-InsetLabel::InsetLabel(InsetCommandParams const & p)
-	: InsetCommand(p, "label")
+InsetLabel::InsetLabel(Buffer const & buf, InsetCommandParams const & p)
+	: InsetCommand(buf, p, "label")
 {}
 
 
Index: src/insets/InsetLabel.h
===================================================================
--- src/insets/InsetLabel.h	(revision 23957)
+++ src/insets/InsetLabel.h	(working copy)
@@ -20,7 +20,7 @@
 class InsetLabel : public InsetCommand {
 public:
 	///
-	InsetLabel(InsetCommandParams const &);
+	InsetLabel(Buffer const &, InsetCommandParams const &);
 
 	/// verify label and update references.
 	/**
Index: src/insets/InsetNomencl.cpp
===================================================================
--- src/insets/InsetNomencl.cpp	(revision 23957)
+++ src/insets/InsetNomencl.cpp	(working copy)
@@ -35,8 +35,9 @@
 //
 /////////////////////////////////////////////////////////////////////
 
-InsetNomencl::InsetNomencl(InsetCommandParams const & p)
-	: InsetCommand(p, "nomenclature"),
+InsetNomencl::InsetNomencl(Buffer const & buf, 
+		InsetCommandParams const & p)
+	: InsetCommand(buf, p, "nomenclature"),
 	  nomenclature_entry_id(sgml::uniqueID(from_ascii("nomen")))
 {}
 
@@ -94,8 +95,9 @@
 //
 /////////////////////////////////////////////////////////////////////
 
-InsetPrintNomencl::InsetPrintNomencl(InsetCommandParams const & p)
-	: InsetCommand(p, string())
+InsetPrintNomencl::InsetPrintNomencl(Buffer const & buf, 
+		InsetCommandParams const & p)
+	: InsetCommand(buf, p, string())
 {}
 
 
Index: src/insets/InsetNomencl.h
===================================================================
--- src/insets/InsetNomencl.h	(revision 23957)
+++ src/insets/InsetNomencl.h	(working copy)
@@ -26,7 +26,7 @@
 class InsetNomencl : public InsetCommand {
 public:
 	///
-	InsetNomencl(InsetCommandParams const &);
+	InsetNomencl(Buffer const &, InsetCommandParams const &);
 	///
 	docstring screenLabel() const;
 	///
@@ -56,7 +56,7 @@
 class InsetPrintNomencl : public InsetCommand {
 public:
 	///
-	InsetPrintNomencl(InsetCommandParams const &);
+	InsetPrintNomencl(Buffer const &, InsetCommandParams const &);
 	/// Updates needed features for this inset.
 	void validate(LaTeXFeatures & features) const;
 	// FIXME: This should be editable to set the label width (stored
Index: src/insets/InsetRef.cpp
===================================================================
--- src/insets/InsetRef.cpp	(revision 23957)
+++ src/insets/InsetRef.cpp	(working copy)
@@ -33,7 +33,7 @@
 
 
 InsetRef::InsetRef(Buffer const & buf, InsetCommandParams const & p)
-	: InsetCommand(p, "ref"), isLatex(buf.isLatex())
+	: InsetCommand(buf, p, "ref"), isLatex(buf.isLatex())
 {}
 
 
Index: src/insets/InsetTOC.cpp
===================================================================
--- src/insets/InsetTOC.cpp	(revision 23957)
+++ src/insets/InsetTOC.cpp	(working copy)
@@ -27,8 +27,8 @@
 namespace lyx {
 
 
-InsetTOC::InsetTOC(InsetCommandParams const & p)
-	: InsetCommand(p, "toc")
+InsetTOC::InsetTOC(Buffer const & buf, InsetCommandParams const & p)
+	: InsetCommand(buf, p, "toc")
 {}
 
 
Index: src/insets/InsetTOC.h
===================================================================
--- src/insets/InsetTOC.h	(revision 23957)
+++ src/insets/InsetTOC.h	(working copy)
@@ -22,7 +22,7 @@
 class InsetTOC : public InsetCommand {
 public:
 	///
-	explicit InsetTOC(InsetCommandParams const &);
+	explicit InsetTOC(Buffer const &, InsetCommandParams const &);
 	///
 	docstring screenLabel() const;
 	///
Index: src/mathed/InsetMathHull.cpp
===================================================================
--- src/mathed/InsetMathHull.cpp	(revision 23957)
+++ src/mathed/InsetMathHull.cpp	(working copy)
@@ -498,9 +498,8 @@
 	}
 	InsetCommandParams p(LABEL_CODE);
 	p["name"] = label;
-	label_[row] = new InsetLabel(p);
-	if (buffer_)
-		label_[row]->setBuffer(buffer());
+	BOOST_ASSERT(buffer_);
+	label_[row] = new InsetLabel(buffer(), p);
 }
 
 
Index: src/Paragraph.cpp
===================================================================
--- src/Paragraph.cpp	(revision 23957)
+++ src/Paragraph.cpp	(working copy)
@@ -2501,8 +2501,7 @@
 
 	// There was no inset at the beginning, so we need to create one with
 	// the key and label of the one we erased.
-	InsetBibitem * inset = new InsetBibitem(InsetCommandParams(BIBITEM_CODE));
-	inset->setBuffer(const_cast<Buffer &>(buffer));
+	InsetBibitem * inset = new InsetBibitem(buffer, InsetCommandParams(BIBITEM_CODE));
 	// restore values of previously deleted item in this par.
 	if (!oldkey.empty())
 		inset->setParam("key", oldkey);
Index: src/Text3.cpp
===================================================================
--- src/Text3.cpp	(revision 23957)
+++ src/Text3.cpp	(working copy)
@@ -1182,6 +1182,10 @@
 				cur.updateFlags(Update::SinglePar | Update::FitCursor);
 				break;			
 			}
+		case mouse_button::none:
+		case mouse_button::button4:
+		case mouse_button::button5:
+			break;
 		} // switch (cmd.button())
 		break;
 
@@ -1257,7 +1261,10 @@
 			// drag & drop context menu.
 			cur.noUpdate();
 			return;
-
+		case mouse_button::none:
+		case mouse_button::button4:
+		case mouse_button::button5:
+			break;
 		} // switch (cmd.button())
 
 		break;
@@ -1687,7 +1694,7 @@
 			setLayout(cur, tclass.defaultLayoutName());
 			ParagraphParameters p;
 			setParagraphs(cur, p);
-			insertInset(cur, new InsetFloatList(to_utf8(cmd.argument())));
+			insertInset(cur, new InsetFloatList(bv->buffer(), to_utf8(cmd.argument())));
 			cur.posForward();
 		} else {
 			lyxerr << "Non-existent float type: "

Reply via email to