Hi Alejandro, All,

I am trying to track down the LyX crashes in math_draw.C:172 on several dosc -
including the LyX tutorial and my thesis :-(

Some more info: If I compile without any optimization LyX runs just fine on my
Alpha, if I use optimization(plain -O) for math_iter.C I get a Segmentation
fault:

(gdb) bt
#0  0x12010a50c in MathParInset::Metrics (this=0x12045d3d0) at math_draw.C:172
#1  0x1200f4f14 in InsetFormula::Read (this=0x12045cf90, lex=@0x11fffe5f8)
    at formula.C:386
#2  0x120123314 in Buffer::readLyXformat2 (this=0x120425f10, lex=@0x11fffe5f8,
    par=0x12045d1b0) at buffer.C:892
#3  0x1201275dc in Buffer::readFile (this=0x120425f10, lex=@0x11fffe5f8,
    par=0x0) at buffer.C:1138
#4  0x1201a0374 in BufferList::readFile (this=0x12033e330, s=@0x11fffeeb0,
    ronly=false) at bufferlist.C:524
#5  0x1201a1f70 in BufferList::loadLyXFile (this=0x12033e330,
    filename=@0x11ffff198, tolastfiles=false) at bufferlist.C:643
#6  0x1200c6eb0 in Menus::MenuDocu (this=0x12039ba80, docname=@0x11ffff2d0)
    at menus.C:1574
#7  0x1200c6278 in Menus::ShowHelpMenu (ob=0x12039e850) at menus.C:1549
#8  0x20000147888 in fl_object_qread ()
#9  0x2000015be8c in fl_check_forms ()
#10 0x120012498 in LyXGUI::runTime (this=0x120371070) at lyx_gui.C:624
#11 0x120007b70 in LyX::LyX (this=0x11ffff870, argc=0x11ffff840,
    argv=0x11ffff938) at ../src/lyx_main.C:119
#12 0x120007114 in main (argc=1, argv=0x11ffff938) at ../src/main.C:51



In the process of looking around I came along the following code:

MathedInset* MathedIter::GetInset()
{
   if (IsInset()) {
       MathedInset* p;
       memcpy(&p, &array->bf[pos+1], sizeof(p));
      return p;
   } else {
      fprintf(stderr,"Math Error: This is not an inset[%d]\n", array->bf[pos]);
     return 0;
   }
}

It doesn't look to bad, but what's about getting rid of the "memcpy" by using
    MathedInset* p = reinterpret_cast< MathedInset * >( &array->bf[pos+1] );
    ( or MathedInset* p = (MathedInset *)( &array->bf[pos+1] ); )
?

And why is it referring to bf[ pos + 1 ] once and bf[ pos ] the other time ?

My change actually doesn't help the crash :-(

Greetings,
Jochen
-----------------------------------------------------------------------
  Jochen K"upper

  Heinrich-Heine-Universit"at D"usseldorf   [EMAIL PROTECTED]
  Institut f"ur Physikalische Chemie I
  Universit"atsstr. 1, Geb 26.43 Raum 02.29    phone ++49-211-8113681
  40225 D"usseldorf                            fax   ++49-211-8115195
  Germany             http://www-public.rz.uni-duesseldorf.de/~jochen
-----------------------------------------------------------------------

Reply via email to