Start a new doc, insert a footnote, go to Documents and select the same doc -> crash.

Because colapsable::edit() doesn't consider that the inset may be already locked, it 
ends
up trying to lock an inset at pos 0 *inside* the footnote, thinking that 
bv->theLockingInset()
exists inside the footnote.

Patch to "fix" the crash is below, but first some questions.

1) shouldn't ::buffer() check to see if we are really switching buffers :

        if (buffer == b) {
                return;
        }

2) how does the slept inset stay locked between the insetSleep and the insetWakeup ? I 
can't
        see why the inset doesn't unlock properly in insetSleep ...

3) insettext and insettabular also have this problem (turn on -dbg insets to see !), 
but the
locking_inset stuff there is FAR too confusing for me to understand. I think they 
survive by
"the skin of their teeth".

Please advise !

thanks
john


Index: insets/insetcollapsable.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetcollapsable.C,v
retrieving revision 1.94
diff -u -r1.94 insetcollapsable.C
--- insets/insetcollapsable.C   2001/10/03 14:28:02     1.94
+++ insets/insetcollapsable.C   2001/11/29 00:06:02
@@ -246,7 +246,7 @@
                bv->updateInset(this, false);
                inset.edit(bv);
        } else {
-               if (!bv->lockInset(this))
+               if (bv->theLockingInset() != this && !bv->lockInset(this))
                        return;
                if (yp <= button_bottom_y) {
                        inset.edit(bv);
@@ -274,7 +274,7 @@
                bv->updateInset(this, false);
                inset.edit(bv, front);
        } else {
-               if (!bv->lockInset(this))
+               if (bv->theLockingInset() != this && !bv->lockInset(this))
                        return;
                inset.edit(bv, front);
        }

Reply via email to