]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetMarginal.cpp
fix a crash when the inset containing the new word at cursor is deleted
[lyx.git] / src / insets / InsetMarginal.cpp
index b4e6e8b39e2a3e53c564d3ed18e68c7b4bda940b..3f1aea0358d782043b7afd814f79c50781978269 100644 (file)
@@ -24,7 +24,7 @@
 namespace lyx {
 
 
-InsetMarginal::InsetMarginal(Buffer const & buf)
+InsetMarginal::InsetMarginal(Buffer * buf)
        : InsetFootlike(buf)
 {}
 
@@ -51,15 +51,15 @@ int InsetMarginal::docbook(odocstream & os,
 }
 
 
-void InsetMarginal::addToToc(DocIterator const & cpit)
+void InsetMarginal::addToToc(DocIterator const & cpit) const
 {
        DocIterator pit = cpit;
-       pit.push_back(CursorSlice(*this));
+       pit.push_back(CursorSlice(const_cast<InsetMarginal &>(*this)));
 
        Toc & toc = buffer().tocBackend().toc("marginalnote");
        docstring str;
-       str = getNewLabel(str);
-       toc.push_back(TocItem(pit, 0, str));
+       text().forToc(str, TOC_ENTRY_LENGTH);
+       toc.push_back(TocItem(pit, 0, str, toolTipText(docstring(), 3, 60)));
        // Proceed with the rest of the inset.
        InsetFootlike::addToToc(cpit);
 }