Merge a patch from GNOME git to fix a crash with printing.

Reported by:	Kevin Oberman <oberman@es.net>
This commit is contained in:
Joe Marcus Clarke 2009-08-08 21:35:28 +00:00
parent 1e74a4277f
commit 0561f1fd60
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=239184
2 changed files with 70 additions and 1 deletions

View file

@ -8,7 +8,7 @@
PORTNAME= gnumeric
PORTVERSION= 1.9.9
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= math gnome
MASTER_SITES= GNOME
DIST_SUBDIR= gnome2

View file

@ -0,0 +1,69 @@
From f4d534730632873339ad0a16419edc835b9c771a Mon Sep 17 00:00:00 2001
From: Andreas J. Guelzow <aguelzow@pyrshep.ca>
Date: Mon, 22 Jun 2009 23:54:08 +0000
Subject: Fix printing crash. [#586672]
2009-06-22 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* src/print-info.c (gnm_page_breaks_clean): we can't and don't need
to clean a non-existing breaks array.
* src/print.c (compute_sheet_pages): fix sense of test anc combine
code
---
--- src/print-info.c
+++ src/print-info.c
@@ -1441,6 +1441,10 @@ void
gnm_page_breaks_clean (GnmPageBreaks *breaks)
{
guint i;
+
+ if (breaks == NULL)
+ return;
+
for (i = 0; i < breaks->details->len; i++) {
GnmPageBreak *pbreak = &g_array_index (breaks->details,
GnmPageBreak, i);
diff --git a/src/print.c b/src/print.c
index 2c0afd4..5fb815a 100644
--- src/print.c
+++ src/print.c
@@ -953,9 +953,18 @@ compute_sheet_pages (GtkPrintContext *context,
repeat_left_start = repeat_left_use ? r.start.col : 0;
repeat_left_end = repeat_left_use ? r.end.col : 0;
- if (pi->ignore_pb) {
- gnm_page_breaks_clean (pinfo->page_breaks.h);
- gnm_page_breaks_clean (pinfo->page_breaks.v);
+ if (!pi->ignore_pb) {
+ if (pinfo->page_breaks.h == NULL)
+ print_info_set_breaks (pinfo,
+ gnm_page_breaks_new (FALSE));
+ else
+ gnm_page_breaks_clean (pinfo->page_breaks.h);
+ if (pinfo->page_breaks.v == NULL)
+ print_info_set_breaks (pinfo,
+ gnm_page_breaks_new (TRUE));
+ else
+ gnm_page_breaks_clean (pinfo->page_breaks.v);
+
}
if (pinfo->scaling.type == PRINT_SCALE_FIT_PAGES) {
@@ -995,15 +1004,6 @@ compute_sheet_pages (GtkPrintContext *context,
usable_x = page_width / px;
usable_y = page_height / py;
- if (!pi->ignore_pb) {
- if (pinfo->page_breaks.h == NULL)
- print_info_set_breaks (pinfo,
- gnm_page_breaks_new (FALSE));
- if (pinfo->page_breaks.v == NULL)
- print_info_set_breaks (pinfo,
- gnm_page_breaks_new (TRUE));
- }
-
paginate (&column_pagination, sheet, r.start.col, r.end.col,
usable_x - row_header_width,
repeat_left_use, repeat_left_start, repeat_left_end,
--
cgit v0.8.2