Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!uunet!dkwgate!twisted.dkw.com!jr From: jr@twisted.dkw.com (J.R. Jesson) Newsgroups: comp.windows.x.motif Subject: Re: _XmCharsetCanonicalize() crashing in motif 1.1.1 Message-ID: <1991Mar27.164253.14453@dkwgate.uucp> Date: 27 Mar 91 16:42:53 GMT Article-I.D.: dkwgate.1991Mar27.164253.14453 References: <6139@mahendo.Jpl.Nasa.Gov> Sender: news@dkwgate.uucp (NewsSoftware) Reply-To: jr@dkwgate.dkw.com Organization: DKW Systems Corporation Lines: 34 In article <6139@mahendo.Jpl.Nasa.Gov>, monica@nereid.jpl.nasa.gov (Monica Rivera) writes: |> |> I am using Douglas Young's xs_str_array_to_xmstr function |> (from The X Window System, Douglas Young, Prentice Hall, 1990, p. 237) |> and it works great in motif 1.1, but I've been getting a core dump |> at the following call when using motif 1.1.1: |> |> xmstr = XmStringConcat(xmstr, |> XmStringCreate(cs[i], |> XmSTRING_DEFAULT_CHARSET) |> ); |> |> This is where dbx says it bombs: *Beautiful* dbx stuff deleted I'm not sure what is causing your dump, but be aware that you _are_ creating a memory leak with that call. In particular, the docs for XmStringCreate say that it creates a new compound string, leaving the two calling args intact. So, by doing the XmStringCreate in-line, and assigning the result of the call to xmstr you are inadvertently allocating memory that you cant free. Here is a safer way do do the call: XmString a, b, xmstr; a = XmStringCreate(cs[i], XmSTRING_DEFAULT_CHARSET); b = xmstr; xmstr = XmStringConcat(a,b); XtFree(a); XtFree(b); --- Hope this helps, J.R. Jesson "The Unix Guy is always the last to know"