Dominik Böhm wrote:
Hello again,
 bug that makes lyx crash.

I was able to reproduce one critical
Create a new file, insert one section at the beginning and then a formula with a matrix (it doesn't matter if it's an inline formula or a display one). Then toggle the outline view. If the cursor is still in the formula, lyx should crash immediately. If not, click into the formula to make lyx crash. That makes the outline view pretty unusful for me.

This is fixed in svn. Andre', JMarc, the problem was in DocIterator::backwardPos():

void DocIterator::backwardPos()
{
        //this dog bites his tail
        if (empty()) {
                push_back(CursorSlice(*inset_));
                top().idx() = lastidx();
                top().pit() = lastpit();
                top().pos() = lastpos();
                return;
        }

        if (top().at_begin()) {
                pop_back();
                return;
        }

        top().backwardPos();

        // move into an inset to the left if possible
        Inset * n = 0;

        if (inMathed())
                n = (top().cell().begin() + top().pos())->nucleus();

Here 'top().cell().begin() + top().pos()' is out of range for the pointed cell. So I guess pos() is not set correctly within a math matrix.

Abdel.

Author: younes
Date: Mon Feb 11 08:47:04 2008
New Revision: 22933

URL: http://www.lyx.org/trac/changeset/22933
Log:
Fix crash when outline pane is launched while the cursor is within a math matrix within a section. The problem was that DocIterator::backwardPos() does not work inside a math matrix.




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

Modified: lyx-devel/trunk/src/TocBackend.cpp
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/TocBackend.cpp?rev=22933
==============================================================================
--- lyx-devel/trunk/src/TocBackend.cpp (original)
+++ lyx-devel/trunk/src/TocBackend.cpp Mon Feb 11 08:47:04 2008
@@ -204,12 +204,11 @@
        --it;

        ParConstIterator par_it_text = par_it;
-       if (par_it_text.inMathed())
-               // It would be better to do
-               //   par_it_text.backwardInset();
-               // but this method does not exist.
+       if (par_it_text.inMathed()) {
+               // We are only interested in text so remove the math 
CursorSlice.
                while (par_it_text.inMathed())
-                       par_it_text.backwardPos();
+                       par_it_text.pop_back();
+       }

        for (; it != last; --it) {
                // We verify that we don't compare contents of two






Reply via email to