gui: Fix printing of tables split across pages in psppire-output-window.
authorBen Pfaff <blp@cs.stanford.edu>
Fri, 2 Dec 2011 06:06:48 +0000 (22:06 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Fri, 2 Dec 2011 06:06:48 +0000 (22:06 -0800)
xr_driver_output_item() expects the caller to call xr_driver_next_page()
as long as xr_driver_need_new_page() returns true, but the printing code
didn't do that, so tables split across pages in printouts caused an
assertion failure at the next call to xr_driver_output_item().

Reported-by: John Darrington <john@darrington.wattle.id.au>
src/ui/gui/psppire-output-window.c

index a0e7479004137a4f636530ba423296f99a8e2242..beb1e9a8e8b07453a2d852c9947d3908b17f37d3 100644 (file)
@@ -1003,7 +1003,7 @@ paginate (GtkPrintOperation *operation,
   if ( window->print_item < window->n_items )
     {
       xr_driver_output_item (window->print_xrd, window->items[window->print_item++]);
-      if (xr_driver_need_new_page (window->print_xrd))
+      while (xr_driver_need_new_page (window->print_xrd))
        {
          xr_driver_next_page (window->print_xrd, NULL);
          window->print_n_pages ++;
@@ -1046,12 +1046,9 @@ draw_page (GtkPrintOperation *operation,
           PsppireOutputWindow *window)
 {
   xr_driver_next_page (window->print_xrd, gtk_print_context_get_cairo_context (context));
-  while ( window->print_item < window->n_items)
-    {
-      xr_driver_output_item (window->print_xrd, window->items [window->print_item++]);
-      if ( xr_driver_need_new_page (window->print_xrd) )
-         break;          
-    }
+  while (!xr_driver_need_new_page (window->print_xrd)
+         && window->print_item < window->n_items)
+    xr_driver_output_item (window->print_xrd, window->items [window->print_item++]);
 }