[comp.windows.open-look] XView bug

renzo@dm.unibo.it (11/30/90)

======================Send reports to xviewbugs@sun.com=====================

===============================Begin bug report===============================
Category:          xview
Subcategory:       library
Bug/Rfe:           bug 
Synopsis:          random "Segmentation Fault" (pw_line frees memory it never allocated) 
Severity:          2
Priority:	      asap
Description:
	Random "Segmentation fault" after line drawing.
	pw_line allocates memory for the structure dash_set only
	if the parameter tex (of type Pr_textur)
	is not NULL. After the drawing action there is no
	control before the freeing of dash_set.
Work around:
	Never call Pr_textur with the tex parameter equal to NULL.
Suggested fix:
	here is the simple patch:
62c62,66
<     (void) free((char *) dash_set);
---
>     /* R.Davoli bug fixed on june 24, 1990 */
>     if (tex)
>     /* end of fix */
>       (void) free((char *) dash_set);
Comments:
	This source chunk comes from the MIT X11-R4 contrib
	distribution.
	The bug seems to be contained in the libxview shipped with the
	Openwin 2.0 package. (I do not have source for it)
	The bug breaks sun3s more frequently than sun4s.

Called in by:
    Customer:
	Company:       University of Bologna
	Employee:      Renzo Davoli
	Contact:       renzo@dm.unibo.it
	Phone #:       +39 51 354480
	Release #:     X Window System V11 R4,
		       Openwin 2.0
	Hardware:      Sun3/50 Sun3/280 Sun4/60
	O/S:           SunOS 
	O/S version:   SunOS 4.0.3
	Server:        OpenWindows & MIT
	Server version:R4
	WindowMmgr:    OLWM TWM
============================End of bug report==================================

-----
Renzo Davoli
Department of Computer Science - University of Bologna
Piazza di Porta S. Donato, 5				Tel. +39 51 354480
40127 Bologna  ITALY					Fax. +39 51 354490
-- 
Renzo Davoli
Department of Computer Science - University of Bologna
Piazza di Porta S. Donato, 5				Tel. +39 51 354480
40127 Bologna  ITALY					Fax. +39 51 354490

hari@matrix.UUCP (T hariharan) (04/25/91)

There seems to be a bug in xv_init() which causes your program to crash.
The following minimal progam (see below) crashes if the following conditions
are satisfied:

1. The X server should NOT be running on the machine where you run the
   program

2. You should NOT have the environment variable DISPLAY defined, and
   you should NOT use the -diplay command line option

All you have to do is log into a machine's console and run the program
wihtout starting X.  You can also rlogin into a machine where the X server
is not running.

If the X server IS running, the program does not crash, even if DISPLAY
is not defined and -display is not used on the command line.

Also, if the X server is NOT running, and DISPLAY is defined, you get
an error message (can't connect to server xxx) instead of a crash.

We would like to let xv_init() establish the connection with the server
without having to use XOpenDisplay() ourselves, and of course, not have
the program crash in the above case.

Any ideas for a workaround for this bug ?
Has anyone seen this bug before (I would expect someone to have) ?

Please email your responses to me. I'll summarize.

Thanks,
Hari

uunet!matrix!hari
Matrix Computer Systems, Inc.
1 Tara Boulevard
Nashua  NH  03062
(603) 888 7790

========================================================================
Command to compile program:
cc -g -I/usr/openwin/include -L/usr/openwin/lib -o bug bug.c -lxview -lX

If you have openwin installed somewhere other than /usr/openwin, please
substitute your openwin directory for /usr/openwin.

Also, you may have to use "-lX11" instead of "-lX" above if libX.a is not
a link to libX11.a on your system.

========================================================================
Program:

/* Save from here to end in bug.c */
#include <stdio.h>
#include <sys/param.h>
#include <sys/types.h>
#include <xview/xview.h>

void
main(argc, argv)
	int		argc;
	char		**argv;
{
	/*
	 * Initialize XView.
	 */
	xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, 0);
	exit(0);
}