Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!decwrl!shlump.dec.com!mipsbx.nac.dec.com!thomas From: thomas@mipsbx.nac.dec.com (Matt Thomas) Newsgroups: comp.unix.ultrix Subject: Re: DS3100: buggy cc Message-ID: <2795@shlump.dec.com> Date: 6 Jun 89 15:12:41 GMT References: <1211@ttds.UUCP> <1207@ttds.UUCP> Sender: news@shlump.dec.com Reply-To: thomas@decwrl.dec.com Organization: Digital Equipment Corporation Lines: 27 > I have not got any responses on my query yet and my problem remains. In the > meantime I have been able to extract the essence of the bug and put it into a > small example which is included below. What can possibly go wrong??? You have a bug in your program. >[most of progam deleted] > > do_nextevent() > { > XAnyEvent e; > > XNextEvent(display, &e); > } XNextEvent takes a pointer to a XEvent as the second parameter, not a pointer to XAnyEvent. The structure XAnyEvent is smaller than XEvent so when XNextEvent copies the event into *e, part fo the stack is over- written causing the segmentation fault. Changing XAnyEvent e to XEvent e will make the program work correctly. -- Matt Thomas Internet: thomas@decwrl.dec.com DECnet-Ultrix Development UUCP: ...!decwrl!thomas Digital Equipment Corporation Disclaimer: This message reflects my own Littleton, MA warped views, etc.