Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!ATHENA.MIT.EDU!kit From: kit@ATHENA.MIT.EDU (Chris D. Peterson) Newsgroups: comp.windows.x Subject: Re: Question on Callbacks Message-ID: <8903102248.AA06321@DORA.MIT.EDU> Date: 10 Mar 89 22:48:11 GMT References: <332@salt.UUCP> Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 40 > I get the infamous "Segmentation fault" error and everything bombs out. > What am I doing wrong ? Saber C to the rescue... In your Private header file the definition for the instance record for you widget is: typedef struct _BaarsBoxRec { CorePart core; BaarsBoxPart BaarsBox; } BaarsBoxRec; It should be: typedef struct _BaarsBoxRec { CorePart core; CompositePart composite; BoxPart box; BaarsBoxPart BaarsBox; } BaarsBoxRec; Since you are leaving out some of the fields the XtOffset() macro gets confused and when you specify a resource (In this case a callback list with XtAddCallback) it scribbles all over your instance record. In your case it was setting the number of children to some garbage value, and thus running off the end of an array, causing a seg. fault. Chris D. Peterson MIT X Consortium / Project Athena Net: kit@athena.mit.edu Phone: (617) 253 - 1326 USMail: MIT - Room E40-321 77 Massachusetts Ave. Cambridge, MA 02139