[comp.windows.x.motif] Text widget overflow

amc@wlv.imsd.contel.com (Allen M. Cohen) (05/24/91)

I'm writing a program which reads lines of text via a pipe and displays
those lines into a text widget embedded within a paned window.
As per the advice of FAQ 14, I'm basically doing:
  XmTextReplace(widget, pos, pos, line);
  pos += strlen(line);
  (void) XmTextShowPosition (widget, (XmTextPosition) pos);

All this works fine, but my problem is that after I feed a sufficient
amount of text to the text widget, the program core dumps!  (I quess the
text is all kept in memory, and Motif ran out of memory).
What's the best way of solving this problem?

Secondly, when I used:
   XtAddInput (fileno(stdin), XtInputReadMask, SysmonCB, NULL);

to assynchronously read data from my input pipe, it stops reading data
whenever the focus leaves the program's toplevel window -- then if I
return the focus, the program core dumps.  I worked around this problem
by doing:
  timeout_id = XtAddTimeOut (SCROLL_DELAY_PIPE, SysmonCB, NULL);

to check the pipe periodically.
(For that matter, the sample program "xbc" in Young Book Ch 5, page 157,
which uses XtAddInput, does not read its input queue until I move the
mouse pointer).

P.S.:  I'm using ISC's version of X11R3/Motif 1.0
<> Allen M. Cohen                  Internet:  amc@wlv.imsd.contel.com       <>
<> 1853 Stonesgate St.             UUCP:      elroy.Jpl.Nasa.Gov!agi0!allen <>
<> Westlake Village, Ca. 91361     Telephone: (805) 498-9611 ext. 195       <>
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>