Re: XForms: fl_get_fontstruct() on error?

Steve Lamont (spl@szechuan.ucsd.edu)
Thu, 23 Jul 98 18:00:55 PDT

# To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> my program terminates each time fl_get_fontstruct() fails.

I was unable to duplicate the failure. Can you provide complete
example code?

> shouldn't one get the chance to inspect the return value and decide
> the fate of the program?

This is the default behavior in Xlib.

If you wish to "fail softly," you can install your own X error
handler:

fl_initialize( &argc, argv, ... )

[...]

XSetErrorHandler( X_lose );

[...]

static int X_lose( Display *display, XErrorEvent *error_event )

{

/* Install your failure handler here */

}

There is also an IO Error Handler which is installed in a similar
manner. Refer to your favorite Xlib manual for further details.

[I generally force a core dump in the error handler just so I can get
a traceback to my offending function call. The core dump is, of
course, only really useful if the program is running in sync mode.]

spl
_________________________________________________
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://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/