[gnumeric] Fix printing crash. [#586672]



commit f4d534730632873339ad0a16419edc835b9c771a
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Mon Jun 22 17:54:08 2009 -0600

    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

 ChangeLog        |    7 +++++++
 NEWS             |   11 ++++++-----
 src/print-info.c |    4 ++++
 src/print.c      |   24 ++++++++++++------------
 4 files changed, 29 insertions(+), 17 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 08de1bc..fad790d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+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
+
 2009-06-21  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* src/func.h (GnmFuncHelpType): add GNM_FUNC_HELP_EXCEL and
diff --git a/NEWS b/NEWS
index 5696905..209a9ba 100644
--- a/NEWS
+++ b/NEWS
@@ -1,11 +1,12 @@
 Gnumeric 1.9.10
 
 Andreas:
-	* Improve ODF export
-	* Add OpenFormula comp. descriptors to some function documentations
-	* Implement new functions CSC, CSCH, SEC, and SECH
-	* Implement new functions LEFTB, MIDB, RIGHTB
-	* Implement ASC and add new function JIS
+	* Improve ODF export.
+	* Add OpenFormula comp. descriptors to some function documentations.
+	* Implement new functions CSC, CSCH, SEC, and SECH.
+	* Implement new functions LEFTB, MIDB, RIGHTB.
+	* Implement ASC and add new function JIS.
+	* Fix printing crash. [#586672]
 
 Morten:
 	* Make SUMIF/COUNTIF and the D* functions understand pattern. [#586215]
diff --git a/src/print-info.c b/src/print-info.c
index 303e856..d84f782 100644
--- a/src/print-info.c
+++ b/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
--- a/src/print.c
+++ b/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,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]