rgheck wrote:

It's hard to tell with all the optimization in the code,

So this isn't a debug build?

but it looks like the error is here:
Paragraph & CursorSlice::paragraph() const
{
   return text()->getPar(pit_);
}
and that it's pit_ that is invalid: pit_ is 0, but there's nothing in text(). I think....

Quite possibly. Text::pars_ is empty at construction and a non-loaded buffer doesn't change that fact. This commit should do it.

Abdel.

Author: younes
Date: Thu Jan 10 09:46:04 2008
New Revision: 22474

URL: http://www.lyx.org/trac/changeset/22474
Log:
* CursorSlice::lastpos(): check for text emptiness (should fix a crash when releasing an empty buffer).

Modified:
    lyx-devel/trunk/src/CursorSlice.cpp

Modified: lyx-devel/trunk/src/CursorSlice.cpp
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/CursorSlice.cpp?rev=22474
==============================================================================
--- lyx-devel/trunk/src/CursorSlice.cpp (original)
+++ lyx-devel/trunk/src/CursorSlice.cpp Thu Jan 10 09:46:04 2008
@@ -61,7 +61,8 @@
 pos_type CursorSlice::lastpos() const
 {
        BOOST_ASSERT(inset_);
-       return inset_->asInsetMath() ? cell().size() : paragraph().size();
+       return inset_->asInsetMath() ? cell().size()
+               : (text()->empty() ? 0 : paragraph().size());
 }





Reply via email to