gtk+ r21358 - in branches/gtk-2-12: . gtk
- From: matthiasc svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk+ r21358 - in branches/gtk-2-12: . gtk
- Date: Fri, 12 Sep 2008 03:46:14 +0000 (UTC)
Author: matthiasc
Date: Fri Sep 12 03:46:13 2008
New Revision: 21358
URL: http://svn.gnome.org/viewvc/gtk+?rev=21358&view=rev
Log:
Bug 545875 â evo crashed when trying to print pages 6-7 of a 1 page
email
* gtk/gtkprintoperation.c: Clamp page ranges to correct ranges.
Patch by Marek Kasik
Modified:
branches/gtk-2-12/ChangeLog
branches/gtk-2-12/gtk/gtkprintoperation.c
Modified: branches/gtk-2-12/gtk/gtkprintoperation.c
==============================================================================
--- branches/gtk-2-12/gtk/gtkprintoperation.c (original)
+++ branches/gtk-2-12/gtk/gtkprintoperation.c Fri Sep 12 03:46:13 2008
@@ -1919,6 +1919,46 @@
}
}
+static void
+clamp_page_ranges (PrintPagesData *data)
+{
+ GtkPrintOperationPrivate *priv;
+ gint num_of_correct_ranges;
+ gint i;
+
+ priv = data->op->priv;
+
+ num_of_correct_ranges = 0;
+
+ for (i = 0; i < data->num_ranges; i++)
+ if ((data->ranges[i].start >= 0) &&
+ (data->ranges[i].start < priv->nr_of_pages) &&
+ (data->ranges[i].end >= 0) &&
+ (data->ranges[i].end < priv->nr_of_pages))
+ {
+ data->ranges[num_of_correct_ranges] = data->ranges[i];
+ num_of_correct_ranges++;
+ }
+ else if ((data->ranges[i].start >= 0) &&
+ (data->ranges[i].start < priv->nr_of_pages) &&
+ (data->ranges[i].end >= priv->nr_of_pages))
+ {
+ data->ranges[i].end = priv->nr_of_pages - 1;
+ data->ranges[num_of_correct_ranges] = data->ranges[i];
+ num_of_correct_ranges++;
+ }
+ else if ((data->ranges[i].end >= 0) &&
+ (data->ranges[i].end < priv->nr_of_pages) &&
+ (data->ranges[i].start < 0))
+ {
+ data->ranges[i].start = 0;
+ data->ranges[num_of_correct_ranges] = data->ranges[i];
+ num_of_correct_ranges++;
+ }
+
+ data->num_ranges = num_of_correct_ranges;
+}
+
static gboolean
increment_page_sequence (PrintPagesData *data)
{
@@ -2132,6 +2172,8 @@
data->ranges[0].end = priv->nr_of_pages - 1;
}
+ clamp_page_ranges (data);
+
if (priv->manual_reverse)
{
data->range = data->num_ranges - 1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]