Re: pw crashes on startup

From: Ulric Eriksson (ulric@siag.nu)
Date: Mon Oct 01 2001 - 00:48:41 CEST


On Sun, 30 Sep 2001, Mikhail Teterin wrote:

> I thought, I reported this before. If pw is started without
> a document, it will segfault upon the very first click into
> the text area. The style_table is being used before being
> initialized:

I can't see how that is possible, although I realize that it *does*
happen. The style_table is populated from styles.scm, which is loaded from
pw.scm before X is even initialized, so there shouldn't even be a text
area to click in. The C function doing the actual style table
initialization is lookup_style. Here's what I get:

8<---
sh-2.05$ gdb pw
GNU gdb 4.18
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
(gdb) break lookup_style
Breakpoint 1 at 0x8053552: file matrix.c, line 134.
(gdb) r
Starting program: /home/ulric/Projekt/siag/xpw/pw

Breakpoint 1, lookup_style (name=0x80f5c40 "Default",
    next=0x80f5c50 "Default", family=0x80f5c60 "Times", size=120, bold=0,
    italic=0, uline=0, strike=0, fg=0x80f5c70 "black") at matrix.c:134
134 s.name = cstrdup(name);
8<---

The only reason I can see for that to fail is if lookup_style is never
called, and the reason for that would be that the code in styles.scm is
not executed.

Can you try the same thing I did above and see if lookup_style is
called at all?

Ulric

>
> Program received signal SIGSEGV, Segmentation fault.
> 0x80587c9 in ret_format (buf=0x811c000, s=0, row=14, col=0) at matrix.c:628
> 628 if (row > buf->sht[s].used_lines) return style_table[0].format;
> (gdb) p style_table
> $1 = (style *) 0x0
> (gdb) up
> #1 0x805a383 in set_point (w=0x8178260, p={row = 14, col = 0})
> at position.c:58
> 58 w->current_fmt = ret_format(w->buf, s, p.row, p.col);
> (gdb) where
> #0 0x80587c9 in ret_format (buf=0x811c000, s=0, row=14, col=0) at matrix.c:628
> #1 0x805a383 in set_point (w=0x8178260, p={row = 14, col = 0})
> at position.c:58
> #2 0x804f260 in set_point_rc (row=14, col=0) at window.c:480
> #3 0x804f6bc in GridButtonAction (w=0x8177a00, event=0xbfbfeb64,
> params=0x8172df0, n=0x8172dd8) at window.c:553
> #4 0x2826e6d5 in HandleActions () from /opt/lib/libXt.so.6
> #5 0x2826eb5a in HandleSimpleState () from /opt/lib/libXt.so.6
> #6 0x2826f0a5 in _XtTranslateEvent () from /opt/lib/libXt.so.6
> #7 0x2824b68e in XtDispatchEventToWidget () from /opt/lib/libXt.so.6
> #8 0x2824c070 in _XtDefaultDispatcher () from /opt/lib/libXt.so.6
> #9 0x2824c2d3 in XtDispatchEvent () from /opt/lib/libXt.so.6
> #10 0x2824c733 in XtAppMainLoop () from /opt/lib/libXt.so.6
> #11 0x80523ca in mainloop () at window.c:1615
> #12 0x805b8c2 in Tcl_AppInit (interp=0x81a6000) at main.c:62
> #13 0x28132001 in Tcl_Main () from /opt/lib/libtcl83.so
> #14 0x805bd4c in realmain (argc=1, argv=0xbfbff718) at main.c:150
> #15 0x805bd6a in main (argc=1, argv=0xbfbff718) at main.c:163
> #16 0x804e1ad in _start ()
>
> As the maintainer of FreeBSD port of siag I'd appreciate a patch :)
> Or a new release with this fixed. Yours,
>
> --
> |\__-----__/|
> _____/ ::::: :::\_____
> '__--( ::::::::..::)--__` -mi
> If you have a / _- \/ :::::::\/ -_
> serious knowledge / / :. .::::\ \
> about computers -- | ::::::::::::| Ok, let's say you broke
> keep it in a secret! _|/ ::::____::\|_ the wall with your head
> "Rules of dating", / /:::::/:_::\::\:.\ What are you going to
> 'Playboy', ? 1994 | :| ..:(_/ \::|::|::| do in the next cell?
> | :|:::::. ::|: |::|.:| Stanislaw J. Lec
> \ |:: :::_/::/: :|:/
> ((___\____\____/___/___))
>



This archive was generated by hypermail 2.1.2 : Mon Oct 01 2001 - 00:49:23 CEST