[GRASS-dev] set_fatal_error
Martin Landa
landa.martin at gmail.com
Mon Jan 14 15:33:44 EST 2008
Hi,
2008/1/14, Glynn Clements <glynn at gclements.plus.com>:
Martin:
> > in Vlib/error.c are defined fns Vect_get_fatal_error(),
> > Vect_set_fatal_error() which are currently used only in Vlib/open.c.
> >
> > 00049 static void
> > 00050 fatal_error ( int ferror, char *errmsg )
> > 00051 {
> > 00052 switch ( ferror ) {
> > 00053 case GV_FATAL_EXIT:
> > 00054 G_fatal_error ( errmsg );
> > 00055 break;
> > 00056 case GV_FATAL_PRINT:
> > 00057 G_warning ( errmsg );
> > 00058 break;
> > 00059 case GV_FATAL_RETURN:
> > 00060 break;
> > 00061 }
> > 00062 }
> >
> > Maybe it would be good to move them to gislib, to enable programmer
> > change behaviour of G_fatal_error() when really need, e.g. to avoid
> > crashing GUI (qgis or native wxpython-based).
Glynn:
> We already have G_set_error_routine(). However, a fundamental property
> of G_fatal_error() is that it doesn't return (that's why the "fatal"
> is part of the name).
right, but it doesn't avoid calling exit(EXIT_FAILURE) in G_fatal_error().
Calling G_fatal_error() causes crashing wxPython GUI e.g. during
digitization. I am not sure how to handle this, since G_fatal_error()
is widely used in Vector library. I guess this could be possible to
solve by using separate thread in Python code(?).
The second point, I guess it was the reason (crashing e.g. qgis) why
(probably by Radim) Vect_*_fatal_error() were added to Vect library.
But it is used only in open.c and legal_vname.c as far as i know.
Avoiding calling exit() in G_fatal_error() in the given case would
make sense, maybe.
Martin
--
Martin Landa <landa.martin at gmail.com> * http://gama.fsv.cvut.cz/~landa *
More information about the grass-dev
mailing list