[Qgis-developer] [GRASS-dev] GRASS & QGIS: the future
Jürgen E. Fischer
jef at norbit.de
Sat Apr 19 06:10:14 PDT 2014
Hi Martin,
On Fri, 18. Apr 2014 at 12:20:15 +0200, Martin Landa wrote:
> [...] I still think that we should provide in GRASS API function like
> G_set_fatal_error() with default value G_FATAL_ERROR_EXIT (current
> behaviour). The second option would be G_FATAL_ERROR_RETURN with big big
> warning in the API manual that you are living GRASS libraries in completely
> unpredictable state and you should immediately stop an application which is
> using GRASS libraries.
I also don't think that would help much. You would still need to use
G_set_error_routine to track that there was an fatal error and in turn avoid a
crash by not touching the result when the call returns - and keep away from
calling other library function because of the unpredictable state of the
library.
On Fri, 18. Apr 2014 at 23:59:25 +0100, Glynn Clements wrote:
> It achieves this by calling exit() (or optionally raising SIGSEGV; why it
> didn't use SIGABRT, I have no idea). Calling longjmp() would work. If it was
> C++, raising an exception would work. Returning will *not* work.
I guess there are also library calls inside the libraries themselves and those
would not be aware that there is a need to handle invalid results and might
crash before the toplevel caller has a chance know of the error.
I think that's Glynn's keypoint.
Using setjmp()/longjmp() or throwing C++ exceptions (with the libraries built
with -fexceptions) in the error routine would take you back to the caller that
is aware of the error. That avoids the crash, but also leaves the library in
an unpredictable state.
To avoid that there's no other way than returning and handling all the errors
properly. Probably huge amount of work with not much gain for GRASS.
The RPC approach will IMHO be less work and also cause less friction.
Jürgen
--
Jürgen E. Fischer norBIT GmbH Tel. +49-4931-918175-31
Dipl.-Inf. (FH) Rheinstraße 13 Fax. +49-4931-918175-50
Software Engineer D-26506 Norden http://www.norbit.de
QGIS PSC member (RM) Germany IRC: jef on FreeNode
--
norBIT Gesellschaft fuer Unternehmensberatung und Informationssysteme mbH
Rheinstrasse 13, 26506 Norden
GF: Jelto Buurman, HR: Amtsgericht Emden, HRB 5502
More information about the Qgis-developer
mailing list