mirror of https://github.com/GNOME/gimp.git
app: avoid potential division by 0 in dashboard CPU usage sampler
This commit is contained in:
parent
fa02a2c64f
commit
394c930fbe
|
@ -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) /
|
||||
|
|
Loading…
Reference in New Issue