[gs-cvs] rev 9121 - trunk/gs/base

leonardo at ghostscript.com leonardo at ghostscript.com
Thu Sep 25 06:36:55 PDT 2008


Author: leonardo
Date: 2008-09-25 06:36:55 -0700 (Thu, 25 Sep 2008)
New Revision: 9121

Modified:
   trunk/gs/base/gdevprn.c
   trunk/gs/base/gxclist.c
Log:
Fix (printer devices) : Allow retries for raster buffer allocation when BufferSpace is default.

DETAILS :

Bug 690055 "seg fault at higher resolutions". 

1. The old code implements a branch with increasing the buffer space
when a clist writer initialization fails with limitcheck and
the buffer size is default.
However the clist writer initialization never returns limitcheck,
it does return rangecheck instead. I guess the bug is in the
retry condition so I change it to rangecheck.

2. When the buffer space size is not default,
the old code crashes while setpagedevice,
if the device was opened. The clist initialization
returns with an inconsistent clist writer state 
and the device still has is_open flag set.
The new code resets is_open if the clist writer initialization
fails while setpagedevice.    

Thanks to Ray for participation.


EXPECTED DIFFERENCES :

None.


Modified: trunk/gs/base/gdevprn.c
===================================================================
--- trunk/gs/base/gdevprn.c	2008-09-25 10:10:03 UTC (rev 9120)
+++ trunk/gs/base/gdevprn.c	2008-09-25 13:36:55 UTC (rev 9121)
@@ -152,7 +152,7 @@
     if (code < 0) {
 	/* If there wasn't enough room, and we haven't */
 	/* already shrunk the buffer, try enlarging it. */
-	if ( code == gs_error_limitcheck &&
+	if ( code == gs_error_rangecheck &&
 	     space >= space_params->BufferSpace &&
 	     !bufferSpace_is_exact
 	     ) {

Modified: trunk/gs/base/gxclist.c
===================================================================
--- trunk/gs/base/gxclist.c	2008-09-25 10:10:03 UTC (rev 9120)
+++ trunk/gs/base/gxclist.c	2008-09-25 13:36:55 UTC (rev 9121)
@@ -625,16 +625,20 @@
 {
     gx_device_clist_writer * const cdev =
 	&((gx_device_clist *)dev)->writer;
+    bool save_is_open = dev->is_open;
     int code;
 
     cdev->permanent_error = 0;
+    cdev->is_open = false;
     code = clist_init(dev);
     if (code < 0)
 	return code;
     code = clist_open_output_file(dev);
     if ( code >= 0)
 	code = clist_emit_page_header(dev);
-    return code;
+    if (code >= 0)
+       dev->is_open = save_is_open;
+     return code;
 }
 
 static int



More information about the gs-cvs mailing list