XForms: fl_initialize kills app if DISPLAY not good

Tristan Savatier (tristan@mpegtv.com)
Wed, 07 Jan 1998 22:42:02 -0800

To subscribers of the xforms list from Tristan Savatier <tristan@mpegtv.com> :

If the DISPLAY env variable is not set properly, i.e.
if the X server connection cannot be opened, it seems that
fl_initialize() kills the application instead of returning
NULL (i.e. an error).

Tested with 0.87 under Linux and Solaris.

Here is the test program:

==============================================================
#include "forms.h"

int main(int argc, char *argv[])
{
Display *display = fl_initialize(&argc, argv, "FormDemo", 0, 0);
printf("display = %d\n", (int)display);
return 0;
}
==============================================================

Try:

$ setenv DISPLAY localhost:0
$ foo
display = 134536352
$ setenv DISPLAY badname:0
$ foo
_X11TransSocketINETConnect: Can't get address for badname
foo: Can't open display badname:0--Invalid argument
$

A workaround is to check that XOpenDisplay (NULL)
does not return NULL before calling fl_initialize...
but I think that fl_initialize should return NULL,
not kill the application.

-t
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bloch.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/