On Tue, Oct 14, 2003 at 05:40:08PM +0200, Alfredo Braunstein wrote: > Bug 1366: Closing a recently pasted collapsable gives a crash. > > The problem is the following: on the mouse press event (we dont even reach > the mouse release = close) we lock in LyXText::dispatch called from (1) the > inset even if we hit the inset button, and then (2) tries to get the cursor > position inside it for setting the layout dropdown. Now on a recently > pasted inset the cursor is still invalid and thus we abort. > > bool BufferView::Pimpl::workAreaDispatch(FuncRequest const & ev) > { > ... > (1) bool const res = dispatch(ev); > ... > (2) owner_->updateLayoutChoice(); > ... > } > > > There are possibly several ways to cure this. The simpler seems to be to > initialize the par offset to 0 in the lyxcursor ctor. (I cannot think of a > side-effect except possibly hiding other problems).
Hm yes. Currently the -1 is a convenient means to check for such problems. So this is really just brushing over problems. I'd do so only on the day before we release 1.4.0. > This has become possible thanks to using offsets instead of pits, of > course. > > For giving a real cure, one should NOT lock an inset Clicking on the button shoul not edit the inset, should it? > that is about to close (it is even a little embarrassing, when you > click to close a collapsable, between the click and the release the > cursor goes inside the inset for no reason). But I don't know if this > is possible, or else if InsetOld::dispatch always assume that the > inset is closed or something. [The real cure, is of course to get rid of all this inset locking stuff and separate the cursor data from the text] > A third way is to initialize the inset's cursor at some point on > creation, but then the first option seems to be reasonable again. > > Comments? 4: You could initialize the cursor before locking the inset if cursor.par() == -1 and make some noise on lyxerr. This way we could keep the -1 sentinel for other places and yet fix that crash. Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson or B. Franklin or both...)