Xref: utzoo comp.windows.x:35351 comp.windows.x.motif:2574 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!bellcore!jello!aw From: aw@jello.bae.bellcore.com (Andrew Wason) Newsgroups: comp.windows.x,comp.windows.x.motif Subject: Re: Wcl/Motif question ( WcCallback seg faults ) Message-ID: <1991Apr16.222832.1956@bellcore.bellcore.com> Date: 16 Apr 91 22:28:32 GMT References: <14109@arctic.nprdc.navy.mil> Sender: usenet@bellcore.bellcore.com (Poster of News) Reply-To: aw@bae.bellcore.com Organization: Bell Communications Research Lines: 48 In article <14109@arctic.nprdc.navy.mil>, apple@nprdc.navy.mil (Jim Apple) writes: > > I need some help with WcCallback, I'm trying to use WcCallback > and XtSetValues to update a XmList widget. But it seg faults > when it gets to the XtSetValues call. Below is a short example of a > resource file and the main.c file. > [...] > *courseList.wcConstructor: XmCreateScrolledList > *courseList.wcCallback: CreateCourseListCB( ) > > [...] > > /* as defined in the resource file */ > > Widget courseList; You declare this global Widget variable. > [...] > > void CreateCourseListCB( w, ignored, unused) > Widget w; > caddr_t ignored; > caddr_t unused; > { > > [...] > > XtSetArg(args[argn], XmNitems, (XtArgVal) courses); argn++; > XtSetArg(args[argn], XmNitemCount, (XtArgVal) 3 ); argn++; > > XtSetValues(courseList,args,argn); And use it without ever setting it. 'courseList' is NULL at this point. You should be using 'w' in your callback. 'w' points to the widget this wcCallback is being called for (the widget named "courseList"). XtSetValues(w,args,argn); Andrew _______________________________________________________________________________ Andrew Wason Bell Communications Research aw@bae.bellcore.com Piscataway, NJ bellcore!bae!aw