Hi,
I am using inkscape-0.41 at an Athlon64 machine. The program was crashing whenever I used some tool which uses bezier curves (caligraphic tool, free hand tool (i think), etc.). The programa failed on a assertion, requiring the last member of a double array to be 1.0, like in: g_assert("bla".., u[len-1] == 1.0)
This kind of comparision (equals) on double is unreliable, since rounding errors may introduce subtle differences between two values which we would expect to be equal.
The correct way to verify this should be like: g_assert("blas",u[len-1]>=0.999 && [len-1]<=1.001).
Where the constants are chosen accordingly.
The code that creates this array is in the function chord_length_parameterize
This is a snipped of chord_length_parameterize:
gdouble tot_len = u[len - 1]; g_return_if_fail( tot_len != 0 ); if (finite(tot_len)) { for (unsigned i = 1; i < len; ++i) { u[i] /= tot_len; } } else { /* We could do better, but this probably never happens anyway. */ for (unsigned i = 1; i < len; ++i) { u[i] = i / (gdouble) ( len - 1 ); } }
In both cases, u[len-1] should be very near 1.0, but not necessarily equals 1.0. I added the line u[len-1] = 1.0; after the loop. And the problem stopped. However, the true bug lies in the comparision (u[len-1]==1.0)
By the way. Thanks for developing this excellent program. I am now deploying it at an workplace in place of Corel Draw.
Yours,
João Rafael Moraes Nicola