[3821] in SIPB bug reports

home help back first fref pref prev next nref lref last post

Re: A bug in the xzwrite source code...

daemon@ATHENA.MIT.EDU (svalente@athena.mit.edu)
Sat Jun 12 08:25:33 1993

From: svalente@athena.mit.edu
Date: Sat, 12 Jun 1993 08:25:20 -0400
To: bugs@athena.mit.edu
Cc: zephyr-bug@athena.mit.edu, bug-sipb@athena.mit.edu



Hmm, bugs about xzwrite go to a lot of lists.  Anyway, wchuang wrote:

    [10551]  (wchuang@Athena.MIT.EDU) Athena Bugs 06/10/93 12:40 (77 lines)
    Subject: A bug in the xzwrite source code...

    A user reported that there was a bug in the source code for xzwrite...
    Anyway, he sent me the following clip of code:

    > From: ringrose@ai.mit.edu (Robert Ringrose)
    > Date: Thu, 10 Jun 93 12:27:28 EDT

    > void edit_yank_store()
    > {
    >      char *buf;
    >
    >      XtVaGetValues(editor,
    >                  XtNstring, (XtArgVal) &buf,
    >                  NULL);
    >
    >      if (buf != NULL && *buf != '\0')
    >           yank_store(&current_dest, buf);
    >
    >      XawAsciiSourceFreeString(editor);
    > }

    The last line of code should be:

        XawAsciiSourceFreeString(buf);

    Apparently there are a bunch more errors like this.

I was unconvinced that that's the right solution, so I decided to UTSL.
To make this message obscenely long, the source is included at the end.

Anyway, the source clearly takes a widget, not a char*.  I dont know
what's causing this bug, or the solution, but I'm reasonably certain
that changing (editor) to (buf) is not the right one.

-- Sal.

-----------------------------------------------------------------------------
---  BELOW THIS LINE IS SOURCE FROM /mit/x11/src/mit/lib/Xaw/AsciiSrc.c.  ---

/*	Function Name: XawAsciiSourceFreeString
 *	Description: Frees the string returned by a get values call
 *                   on the string when the source is of type string.
 *	Arguments: w - the AsciiSrc widget.
 *	Returns: none.
 */

void
#if NeedFunctionPrototypes
XawAsciiSourceFreeString(Widget w)
#else
XawAsciiSourceFreeString(w)
Widget w;
#endif
{
  AsciiSrcObject src = (AsciiSrcObject) w;

  if (src->ascii_src.allocated_string && src->ascii_src.type != XawAsciiFile) {
    src->ascii_src.allocated_string = FALSE;
    XtFree(src->ascii_src.string);
    src->ascii_src.string = NULL;
  }
}

home help back first fref pref prev next nref lref last post