On Thu, 6 Dec 2001, Allan Rae wrote:
> Ahhh I just spotted something interesting -- another case -- this time
> a segfault.  This also crashes if you leave out the
> "insert->figure->float" step but importantly the cursor has to have
> been in a dummy position in the tabular when you click on the figure.

Tabular may also be to blame.

The use of the_locking_inset there seems haphazard at best.  Some
places seem to clear the_locking_inset after an unlock call while
others don't.

Code like:
                        if (the_locking_inset) {
                                unlockInsetInInset(bv, the_locking_inset);
                                the_locking_inset = 0;
                        }

seems to me to be equivalent to:

                        unlockInsetInInset(bv, the_locking_inset);
                        the_locking_inset = 0;

and could be written as:

                        if (unlockInsetInInset(bv, the_locking_inset)) {
                                the_locking_inset = 0;
                        }

but that isn't really any faster or better but might expose other
bugs.

unlockInsetInInset() will do the check for the_locking_inset. The
second line unconditionally resets the_locking_inset while
unlockInsetInset() only resets it if this insets inset is the locking
inset.  The return value of unlockInsetInInset() tells whether it
found a locking inset further down in the nested inset structure.

Is there a plan to use the return value at anytime or should the
following lines also reset the_locking_inset unconditionally like all
the other instances in insettabular.C?

insettabular.C:1732:            unlockInsetInInset(bv, the_locking_inset);
insettabular.C:1738:            unlockInsetInInset(bv, the_locking_inset);
insettabular.C:1744:            unlockInsetInInset(bv, the_locking_inset);
insettabular.C:1755:            unlockInsetInInset(bv, the_locking_inset);


There appear as though there may be a few places where
InsetText::the_locking_inset isn't cleared after an unlock attempt but
the code using that seems scattered about a bit more.  In particular I
can't really see anywhere that ensures InsetText::the_locking_inset is
cleared if unlockInsetInInset() returns true even some code does
actually test the returned result.

Maybe I'm misunderstanding something.  If an inner inset is locked and
I unlock it should the outer inset also be unlocked?

Allan. (ARRae)

Reply via email to