* insettext.C (insetAllowed): fixed for the case that we directly
ask the insettext from it's LyXText.
+ (paragraph): fixed the crash when assigning the par->next() from
+ the EmptyParagraphMechanism!
2001-12-05 Lars Gullik Bjønnes <larsbj@birdstep.com>
void InsetText::paragraph(Paragraph * p)
{
// first we have to delete the old contents otherwise we'll have a
- // memory leak!
- the_locking_inset = 0;
- while (par) {
- Paragraph * tmp = par->next();
- delete par;
- par = tmp;
+ // memory leak! But there check that we don't delete the paragraphs
+ // the new par is refering to (could happen in LyXText::EmptyParagrapM...)
+ // well don't do deletes at all if we come from there. Really stupid
+ // thing! (Jug 20011205)
+ if (par->next() != p) {
+ the_locking_inset = 0;
+ while (par && par != p) {
+ Paragraph * tmp = par->next();
+ delete par;
+ par = tmp;
+ }
}
par = p;
// set ourself as owner for all the paragraphs inserted!
setUndo(bview, Undo::DELETE, old_cursor.par(), endpar);
cursor = tmpcursor;
- // delete old row
+ // delete old row
removeRow(old_cursor.row());
if (ownerParagraph() == old_cursor.par()) {
ownerParagraph(ownerParagraph()->next());