Abdelrazak Younes <[EMAIL PROTECTED]> writes: > Alfredo Braunstein wrote: > > I did a bit of research, and I think I found something, and it seems > > a mess. Please correct me if I'm wrong, this is what I understand: > > > > Text::dispatch(LFUN_FLOAT_INSERT) calls dispatches > > Cursor::dispatch(LFUN_CAPTION_INSERT) to insert the CAPTION. > > One possible general problem with this may be that Cursor::dispatch is not > > reentrant-safe (see beforeDispatch members). > > I've looked at it more closely and you're right. We should either use > the local Text::dispatch() method or make sure the savings of > beforeDispX and beforeDispY happen before Cursor::dispatch():
Glad to know that my research was somewhat useful ;-) > > // store some values to be used inside of the handlers > getPos(beforeDispX_, beforeDispY_); > > For trunk, I think we should replace all occurence of > cur.dispatch() with this->dispatch() in Text3::dispatch(). This seems good indeed. In the long run, however, we should think of a way to enforce this so we don't have to check manually (even some assert at run time would be nice). Moreover, I don't see what do we gain by using a lyxfunc internally, probably we should just put the content of the corresponding dipatch code (that just inserts an inset!) in a standalone function and call that instead. > For BRANCH_1_5 I think the simpler solution is to move the getPos() call > above at the beginning of the LFUN machinery: LyXFunc::dispatch(). Wasnt't there also a beforDispatchCursor_ dociterator inside Cursor? I'm traveling and I don't have a tree at hand, but I remember so. > > The real problem in this case > > seems to be that the dispatch machinery assumes up-to-date metrics > > (Cursor::dispatch calls getPos), whereas in this case the Collapsable was > > already inserted and the metrics still not updated. > > I'll commit a hot fix shortly. Ok. ;-) A/