[gimp] app: the tests should succeed, so should a normal gimp session



commit ac6ee071849a3e1572007aa45c33d8d2f198653c
Author: Michael Natterer <mitch gimp org>
Date:   Sun Jun 20 23:26:45 2010 +0200

    app: the tests should succeed, so should a normal gimp session
    
    Don't divide by zero in gimp_session_info_class_apply_position_accuracy()
    when klass->position_accuracy is 0, which happens on each exit in a normal
    session.

 app/widgets/gimpsessioninfo.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/app/widgets/gimpsessioninfo.c b/app/widgets/gimpsessioninfo.c
index 297fc16..2d5a9eb 100644
--- a/app/widgets/gimpsessioninfo.c
+++ b/app/widgets/gimpsessioninfo.c
@@ -898,11 +898,14 @@ gint
 gimp_session_info_class_apply_position_accuracy (GimpSessionInfoClass *klass,
                                                  gint                  position)
 {
-  gint n = klass->position_accuracy;
-  gint to_floor;
-
   g_return_val_if_fail (GIMP_IS_SESSION_INFO_CLASS (klass), position);
 
-  to_floor = position + n / 2;
-  return to_floor - to_floor % n;
+  if (klass->position_accuracy > 0)
+    {
+      gint to_floor = position + klass->position_accuracy / 2;
+
+      return to_floor - to_floor % klass->position_accuracy;
+    }
+
+  return position;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]