summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2013-11-09 23:51:50 -0500
committerMatthias Clasen <mclasen@redhat.com>2013-11-09 23:51:50 -0500
commite09719b12d034568bbb50b7e6aaff78138d6b58c (patch)
treeb034cd31db70f3e94b0e20822362606c17b0c504
parent280fc402be5fb46b66bcd32056963bb1afb8b54b (diff)
downloadgtk+-e09719b12d034568bbb50b7e6aaff78138d6b58c.tar.gz
Prevent a possible warning
When doing updates, gtk_progress_bar_real_update can calculate compute a negative value for activity_pos. If the allocation width is smaller than (xthickness + size), pbar->activity_pos will be set to a negative value and this will cause the drawing code to emit a warning about coordinates being out of bounds. Prevent this by keeping the value at least 0. https://bugzilla.gnome.org/show_bug.cgi?id=701751
-rw-r--r--gtk/gtkprogressbar.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gtk/gtkprogressbar.c b/gtk/gtkprogressbar.c
index a21e762249..bd8933d925 100644
--- a/gtk/gtkprogressbar.c
+++ b/gtk/gtkprogressbar.c
@@ -463,8 +463,8 @@ gtk_progress_bar_real_update (GtkProgress *progress)
widget->allocation.width -
widget->style->xthickness)
{
- pbar->activity_pos = widget->allocation.width -
- widget->style->xthickness - size;
+ pbar->activity_pos = MAX (0, widget->allocation.width -
+ widget->style->xthickness - size);
pbar->activity_dir = 1;
}
}
@@ -493,8 +493,8 @@ gtk_progress_bar_real_update (GtkProgress *progress)
widget->allocation.height -
widget->style->ythickness)
{
- pbar->activity_pos = widget->allocation.height -
- widget->style->ythickness - size;
+ pbar->activity_pos = MAX (0, widget->allocation.height -
+ widget->style->ythickness - size);
pbar->activity_dir = 1;
}
}