[493] in Zephyr_Bugs
Re: A bug in the xzwrite source code...
daemon@ATHENA.MIT.EDU (svalente@Athena.MIT.EDU)
Tue Jul 6 02:46:38 1993
From: svalente@Athena.MIT.EDU
Date: Tue, 6 Jul 93 02:46:34 -0400
To: zephyr-bugs@Athena.MIT.EDU, bjaspan@Athena.MIT.EDU, wchuang@Athena.MIT.EDU,
wchuang wrote:
> if (buf != NULL && *buf != '\0')
> yank_store(¤t_dest, buf);
>
> XawAsciiSourceFreeString(editor);
> }
The last line of code should be:
XawAsciiSourceFreeString(buf);
Neither of those are entirely correct. Actually,
XawAsciiSourceFreeString() takes an AsciiSource widget, which is a
resource of the editor. Included is a patch to fix the calls to
XawAscii....() in the two .c files that they occur in.
diff -c /mit/zephyr/src/clients/xzwrite/edit_window.c edit_window.c
*** /mit/zephyr/src/clients/xzwrite/edit_window.c Sat Mar 23 11:06:01 1991
--- edit_window.c Tue Jul 6 02:13:47 1993
***************
*** 21,35 ****
{
char *buf;
int ret;
/* I should do more interesting things with these error conditions */
XtVaGetValues(editor,
XtNstring, (XtArgVal) &buf,
NULL);
ret = zeph_send_message(¤t_dest, buf);
! XawAsciiSourceFreeString(editor);
switch (ret) {
case SEND_OK:
--- 21,37 ----
{
char *buf;
int ret;
+ Widget text_source;
/* I should do more interesting things with these error conditions */
XtVaGetValues(editor,
XtNstring, (XtArgVal) &buf,
+ XtNtextSource, (XtArgVal) &text_source,
NULL);
ret = zeph_send_message(¤t_dest, buf);
! XawAsciiSourceFreeString(text_source);
switch (ret) {
case SEND_OK:
***************
*** 111,123 ****
void edit_yank_store()
{
char *buf;
XtVaGetValues(editor,
! XtNstring, (XtArgVal) &buf,
! NULL);
if (buf != NULL && *buf != '\0')
yank_store(¤t_dest, buf);
! XawAsciiSourceFreeString(editor);
}
--- 116,130 ----
void edit_yank_store()
{
char *buf;
+ Widget text_source;
XtVaGetValues(editor,
! XtNstring, (XtArgVal) &buf,
! XtNtextSource, (XtArgVal) &text_source,
! NULL);
if (buf != NULL && *buf != '\0')
yank_store(¤t_dest, buf);
! XawAsciiSourceFreeString(text_source);
}
diff -c /mit/zephyr/src/clients/xzwrite/GetString.c GetString.c
*** /mit/zephyr/src/clients/xzwrite/GetString.c Fri Nov 16 11:14:38 1990
--- GetString.c Tue Jul 6 02:13:42 1993
***************
*** 80,90 ****
if (accepted) {
char *s;
! XtVaGetValues(edit, XtNstring, (XtArgVal) &s, NULL);
strncpy(buf, s, len-2);
buf[len-1] = '\0';
! XawAsciiSourceFreeString(edit);
return GETSTRING_ACCEPT;
}
--- 80,94 ----
if (accepted) {
char *s;
+ Widget text_source;
! XtVaGetValues(edit,
! XtNstring, (XtArgVal) &s,
! XtNtextSource, (XtArgVal) &text_source,
! NULL);
strncpy(buf, s, len-2);
buf[len-1] = '\0';
! XawAsciiSourceFreeString(text_source);
return GETSTRING_ACCEPT;
}