[comp.windows.x] X programming question

njacobs@nssdca.gsfc.nasa.gov (Nick Jacobs) (03/12/91)

I'm new to X Window programming ... I typed in the example program
"helloworld.c" from Oliver Jones' book, "Introduction to the X Window
system", compiled, linked with the libs on a Sun, and ran it using
a remote server for the display (eXodus on a Mac, not that it should
matter). It does what it is supposed to do, except that when I tell it
to quit by hitting 'q', it crashes instead of terminating cleanly.
The error message is:
[2] Bus error      xhello core dumped

(I called it xhello).
All it does when it gets a 'q' that is different from any other 
keypress (which it correctly ignores) is to call XFreeGC,
XDestroyWindow, XCloseDisplay and exit. Does anyone have any
idea why it should crash??

Nick

dsr@mir.mitre.org (Douglas S. Rand) (03/13/91)

In article <4577@dftsrv.gsfc.nasa.gov>, njacobs@nssdca.gsfc.nasa.gov (Nick Jacobs) writes:
> I'm new to X Window programming ... I typed in the example program
> "helloworld.c" from Oliver Jones' book, "Introduction to the X Window
> system", compiled, linked with the libs on a Sun, and ran it using
> a remote server for the display (eXodus on a Mac, not that it should
> matter). It does what it is supposed to do, except that when I tell it
> to quit by hitting 'q', it crashes instead of terminating cleanly.
> The error message is:
> [2] Bus error      xhello core dumped
> 
> (I called it xhello).
> All it does when it gets a 'q' that is different from any other 
> keypress (which it correctly ignores) is to call XFreeGC,
> XDestroyWindow, XCloseDisplay and exit. Does anyone have any
> idea why it should crash??
> 
> Nick

I'll give you some observations.  Your program is probably not dying 
because of an X server problem.  It is probably dying because of a 
bad parameter passed to Xlib or even a bad pointer in your program.
Did you try using a symbolic debugger to find out what source line
killed it?  X errors happen in a different way and result in a printed
message (by default) and exiting to the shell.

-- 
Douglas S. Rand 
Internet:   <dsrand@mitre.org>
Snail:	    MITRE, Burlington Road, Bedford, MA 
Disclaimer: MITRE might agree with me - then again...
Amateur Radio: KC1KJ