[gimp] app: avoid potential division by 0 in dashboard CPU usage sampler
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: avoid potential division by 0 in dashboard CPU usage sampler
- Date: Wed, 4 Apr 2018 21:53:43 +0000 (UTC)
commit 394c930fbe6c2004f4fb2c1f106a3fd686f38d22
Author: Ell <ell_se yahoo com>
Date: Wed Apr 4 13:00:40 2018 -0400
app: avoid potential division by 0 in dashboard CPU usage sampler
app/widgets/gimpdashboard.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/app/widgets/gimpdashboard.c b/app/widgets/gimpdashboard.c
index 6388011..07e1d7a 100644
--- a/app/widgets/gimpdashboard.c
+++ b/app/widgets/gimpdashboard.c
@@ -1644,7 +1644,7 @@ gimp_dashboard_sample_cpu_usage (GimpDashboard *dashboard,
curr_usage = tms.tms_utime + tms.tms_stime;
- if (prev_clock)
+ if (prev_clock && curr_clock != prev_clock)
{
variable_data->available = TRUE;
variable_data->value.percentage = (gdouble) (curr_usage - prev_usage) /
@@ -1701,7 +1701,7 @@ gimp_dashboard_sample_cpu_usage (GimpDashboard *dashboard,
curr_usage += ((guint64) process_user_time.dwHighDateTime << 32) |
(guint64) process_user_time.dwLowDateTime;
- if (prev_time)
+ if (prev_time && curr_time != prev_time)
{
variable_data->available = TRUE;
variable_data->value.percentage = (gdouble) (curr_usage - prev_usage) /
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]