Issue #2635 - Segfault when using measuring tool

In gimp_tool_compass_update_angle(), use fuzzy comparisson when
determining whether to update the angle properties, to avoid
infinite recursion due to floating-point inaccuracies.  In
partcicular, on x86, when using the x87 FPU rather than SSE, the
floating-point registers are 80-bit, while the properties are
stored as 64-bit, which can create small discrepancies between the
calculated angles and the stored values.
This commit is contained in:
Ell 2018-12-08 05:59:05 -05:00
parent db18c679f3
commit ad831dbc6d
1 changed files with 2 additions and 2 deletions

View File

@ -1155,14 +1155,14 @@ gimp_tool_compass_update_angle (GimpToolCompass *compass,
}
}
if (pixel_angle != private->pixel_angle)
if (fabs (pixel_angle - private->pixel_angle) > EPSILON)
{
private->pixel_angle = pixel_angle;
g_object_notify (G_OBJECT (compass), "pixel-angle");
}
if (unit_angle != private->unit_angle)
if (fabs (unit_angle - private->unit_angle) > EPSILON)
{
private->unit_angle = unit_angle;