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). This has become possible thanks to using offsets instead of pits, of course. For giving a real cure, one should NOT lock an inset 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. 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? Alfredo