Abdelrazak Younes wrote:
Alfredo Braunstein wrote:
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():
// 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().
I've done this. We should replace all occurrences IMO because we'll see
more of this kind of crash for sure.
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().
I'll try that solution, but I'd prefer that we use my solution for
trunk. Opinion Jurgen?
Abdel.
Author: younes
Date: Mon Aug 27 11:03:18 2007
New Revision: 19827
URL: http://www.lyx.org/trac/changeset/19827
Log:
Lyx crashed after inserting, deleting and inserting float object.
Modified:
lyx-devel/trunk/src/Text3.cpp
Modified: lyx-devel/trunk/src/Text3.cpp
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/Text3.cpp?rev=19827
==============================================================================
--- lyx-devel/trunk/src/Text3.cpp (original)
+++ lyx-devel/trunk/src/Text3.cpp Mon Aug 27 11:03:18 2007
@@ -1271,7 +1271,11 @@
// reposition the cursor to the caption
cur.pit() = cap_pit;
cur.pos() = 0;
- cur.dispatch(FuncRequest(LFUN_CAPTION_INSERT));
+ // FIXME: This Text/Cursor dispatch handling is a mess!
+ // We cannot use Cursor::dispatch here it needs access to up to
+ // date metrics.
+ cur.text()->dispatch(cur, FuncRequest(LFUN_CAPTION_INSERT));
+ cur.updateFlags(Update::Force);
// FIXME: When leaving the Float (or Wrap) inset we should
// delete any empty paragraph left above or below the
// caption.