From ce5029dfa9019fb408de180d446e1ffb8cbdc7e7 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Thu, 16 May 2002 16:57:18 +0000 Subject: [PATCH] Fix a missed check for division by zero. (#77820, Gareth Pearce) Thu May 16 12:56:38 2002 Owen Taylor * gtk/gtkrange.c (gtk_range_calc_layout): Fix a missed check for division by zero. (#77820, Gareth Pearce) --- ChangeLog | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-2 | 5 +++++ ChangeLog.pre-2-4 | 5 +++++ ChangeLog.pre-2-6 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ gtk/gtkrange.c | 6 +++++- 7 files changed, 35 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0a8ca6ae3c..c22935ecce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu May 16 12:56:38 2002 Owen Taylor + + * gtk/gtkrange.c (gtk_range_calc_layout): Fix a missed + check for division by zero. (#77820, Gareth Pearce) + Thu May 16 12:50:13 2002 Owen Taylor * gdk/x11/gdkevents-x11.c (gdk_xsettings_notify_cb): diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 0a8ca6ae3c..c22935ecce 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +Thu May 16 12:56:38 2002 Owen Taylor + + * gtk/gtkrange.c (gtk_range_calc_layout): Fix a missed + check for division by zero. (#77820, Gareth Pearce) + Thu May 16 12:50:13 2002 Owen Taylor * gdk/x11/gdkevents-x11.c (gdk_xsettings_notify_cb): diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 0a8ca6ae3c..c22935ecce 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,8 @@ +Thu May 16 12:56:38 2002 Owen Taylor + + * gtk/gtkrange.c (gtk_range_calc_layout): Fix a missed + check for division by zero. (#77820, Gareth Pearce) + Thu May 16 12:50:13 2002 Owen Taylor * gdk/x11/gdkevents-x11.c (gdk_xsettings_notify_cb): diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 0a8ca6ae3c..c22935ecce 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +Thu May 16 12:56:38 2002 Owen Taylor + + * gtk/gtkrange.c (gtk_range_calc_layout): Fix a missed + check for division by zero. (#77820, Gareth Pearce) + Thu May 16 12:50:13 2002 Owen Taylor * gdk/x11/gdkevents-x11.c (gdk_xsettings_notify_cb): diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 0a8ca6ae3c..c22935ecce 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +Thu May 16 12:56:38 2002 Owen Taylor + + * gtk/gtkrange.c (gtk_range_calc_layout): Fix a missed + check for division by zero. (#77820, Gareth Pearce) + Thu May 16 12:50:13 2002 Owen Taylor * gdk/x11/gdkevents-x11.c (gdk_xsettings_notify_cb): diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 0a8ca6ae3c..c22935ecce 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +Thu May 16 12:56:38 2002 Owen Taylor + + * gtk/gtkrange.c (gtk_range_calc_layout): Fix a missed + check for division by zero. (#77820, Gareth Pearce) + Thu May 16 12:50:13 2002 Owen Taylor * gdk/x11/gdkevents-x11.c (gdk_xsettings_notify_cb): diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c index 6ce27d35a8..d815343de2 100644 --- a/gtk/gtkrange.c +++ b/gtk/gtkrange.c @@ -2181,8 +2181,12 @@ gtk_range_calc_layout (GtkRange *range, /* slider width is the fraction (page_size / * total_adjustment_range) times the trough width in pixels */ - width = ((right - left) * (range->adjustment->page_size / + + if (range->adjustment->upper - range->adjustment->lower != 0) + width = ((right - left) * (range->adjustment->page_size / (range->adjustment->upper - range->adjustment->lower))); + else + width = range->min_slider_size; if (width < range->min_slider_size || range->slider_size_fixed)