-----Original Message----- From: lib2geom-devel-bounces@lists.sourceforge.net [mailto:lib2geom-devel-bounces@lists.sourceforge.net] On Behalf Of MenTaLguY Sent: vrijdag 27 juni 2008 8:24 To: bulia byak Cc: Jon A. Cruz; lib2geom-devel@lists.sourceforge.net; inkscape-devel@lists.sourceforge.net Subject: Re: [Lib2geom-devel] [Inkscape-devel] Crash in 2geom ellipse parsing
On Thu, 2008-06-26 at 23:33 -0400, bulia byak wrote:
These particular crashes are found and fixed, yes. But how
can you be
sure that there are no other assert-crashes that are missed by our sketchy developer-testing, get released, and make Inkscape
feel crashy
and flakey to the users - who therefore may feel
disinclined to even
report them?
Without assertions, invariant failures still tend to eventually result in crashes, *especially* in C/C++. Removing assertions would certainly help to obscure the cause of a crash, but crashes would not be entirely prevented, only rendered less predictable (and therefore less likely to be caught by our sketchy developer-testing).
This is why I have proposed to replace assertions with exceptions in lib2geom (and already did a few). Then we don't have to remove/disable the assertions, and we end up with a system that can recover on error. For LPEs, exceptions instead of asserts have proven to be much easier to work with. Instead of getting a bug report: "when i wiggle this line somewhere special, it crashes, don't know when". I get: "for the attached SVG, I get an LPE error". (LPE 2geom exceptions are handled by simply aborting the calculation and showing the original path, so it is very easy to see when an error happens and because Inkscape doesn't crash, you can save the data and attach it to a bugreport)
Do we have a flag in Inkscape for release/debug that can be used to #ifdef some code? For example, the parser calling code now catches the 2geom exception, outputs path string to screen and then rethrows the exception. For release only, instead of rethrowing it might want to return an empty path instead of throwing an exception.
Johan