On Fri, 12 Mar 1999, Volker Enderlein wrote:
> Hi,
>
> I did almost everything you wrote, but it didn't prevent LyX 1.0.1 from
> crashing. It follows the gdb output.
Thanks, I now know what caused the segfault but I'm not sure what to do
to stop it.
[...]
> Breakpoint 2, LyXGUI::LyXGUI (this=0x100bf870, owner=0x7fff2ee8,
> argc=0x7fff2f20, argv=0x7fff2f44, GUI=void) at lyx_gui.C:174
> 174 if (!gui)
> (gdb) print background_color
> $1 = {p = 0x0}
Here's the culprit.
background_color hasn't been constructed yet!!
[...]
> 191 background_color = b_c;
> (gdb) print *background_color.p
> Cannot access memory at address 0x0.
further proof.
> Breakpoint 1, LString::operator= (this=0x10051020, s=0x100513c8 "linen") at
> LString.C:93
> 93 static srep empty_rep;
> (gdb) info locals
> this = (LString *) 0x10051020
> empty_rep = {l = 0, n = 1, e = 0, s = ""}
empty_rep has been constructed and used already as I expected.
> (gdb) print *this.p
> Cannot access memory at address 0x0.
> (gdb) info br
> Num Type Disp Enb Address What
> 1 breakpoint keep y 0x00629738 in LString::operator=(char const *) at
> LString.C:93
> breakpoint already hit 61 times
Same results as I get running here apart from the lack of the construction
of background_color.
[...]
> Hope that helps you
Yes and no. I know what's wrong but I'm not sure what we can do to work
around it. Since background_color hasn't been constructed yet that means
gcc on Irix is busted. All file scope statics are supposed to be
constructed *before* any code in the corresponding file is executed but
this clearly hasn't happened.
Any other developers got any ideas what we can do here? (apart from file a
bug report to gcc maintainers)
One possibility might be to use a global function like:
LString & background_color()
{
static LString bg_color;
return bg_color;
}
to replace background_color. But that would mean changing lots of code
and then lead us on to the next unconstructed global. I fear Victor that
you will have to try the Irix binary at ftp.lyx.org or try the native
compiler. (Unless I've missed something else)
I'll give it a bit more thought,
Allan. (ARRae)