On Thursday 11 July 2002 7:01 pm, Kornel Benko wrote:
> On Thursday 11 July 2002 18:38, Angus Leeming wrote:
> > Attached is a "smart loader" for the previews. I'd really, really like
> > interested users --- that's the mathematicians out there who use /lots/
> > of equations to test it out.
>
> Super!

Great!

> I tried it and I like it. But on the last page I had a core dump.

Hmmm!

> gdb backtrace:
> (gdb) bt
> #0  0x402b9ab1 in kill () from /lib/libc.so.6
> #1  0x402b98a8 in raise () from /lib/libc.so.6
> #2  0x402baedb in abort () from /lib/libc.so.6
> #3  0x083f6bbb in lyx::abort ()
> #4  0x081167f8 in error_handler ()
> #5  <signal handler called>
> #6  0x083f408c in getVisibleRows ()

That means I'm doing something illegal.

> It does not look very hellpful, does it?

Does this cure the problem?

RowList const getVisibleRows(BufferView const & bv)
{
        RowList rows;

        // top_y is not const because it's reset by getRowNearY.
        int top_y = bv.text->first_y;
        Row const * row = bv.text->getRowNearY(top_y);

        int const bv_height = bv.painter().paperHeight();
        int height = row->height();
        rows.push_back(row);

        while (height < bv_height) {
                row = row->next();
+               if (!row)
+                       break;
                height += row->height();
                rows.push_back(row);
        }

        return rows;
}


Angus

Reply via email to