]> git.lyx.org Git - features.git/blobdiff - src/insets/insettext.C
Various fixes (PageDown/Up, reading kmap, drawing tabular lines).
[features.git] / src / insets / insettext.C
index e4094c7c8709fb2045a82e0e75f827af0be19017..0dc00b5668801bd5be29728b98fe95c2f3a376cd 100644 (file)
@@ -112,6 +112,8 @@ void InsetText::init(InsetText const * ins)
 
 InsetText::~InsetText()
 {
+    // delete all instances of LyXText before deleting the paragraps used
+    // by it.
     for(Cache::const_iterator cit = cache.begin(); cit != cache.end(); ++cit)
        delete (*cit).second;
     LyXParagraph * p = par->next;
@@ -126,6 +128,10 @@ InsetText::~InsetText()
 
 void InsetText::clear()
 {
+    // delete all instances of LyXText before deleting the paragraps used
+    // by it.
+    for(Cache::const_iterator cit = cache.begin(); cit != cache.end(); ++cit)
+       delete (*cit).second;
     LyXParagraph * p = par->next;
     delete par;
     while(p) {
@@ -169,6 +175,11 @@ void InsetText::Read(Buffer const * buf, LyXLex & lex)
 #endif
     LyXFont font(LyXFont::ALL_INHERIT);
 
+    // delete all instances of LyXText before deleting the paragraps used
+    // by it.
+    for(Cache::const_iterator cit = cache.begin(); cit != cache.end(); ++cit)
+       delete (*cit).second;
+
     LyXParagraph * p = par->next;
     delete par;
     while(p) {
@@ -1374,8 +1385,12 @@ int InsetText::getMaxWidth(Painter & pain, UpdatableInset const * inset) const
 
 void InsetText::SetParagraphData(LyXParagraph *p)
 {
-    LyXParagraph * np;
+    // delete all instances of LyXText before deleting the paragraps used
+    // by it.
+    for(Cache::const_iterator cit = cache.begin(); cit != cache.end(); ++cit)
+       delete (*cit).second;
 
+    LyXParagraph * np;
     if (par) {
        np = par->next;
        delete par;