components/ghostscript/patches/7201968.patch
branchs11u1-sru
changeset 2487 2cbbabd0bbf4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ghostscript/patches/7201968.patch	Sun Feb 10 22:22:25 2013 -0800
@@ -0,0 +1,82 @@
+This is a known bug with ghostscript-9.00
+http://bugs.ghostscript.com/show_bug.cgi?id=691619
+======================================================================
+--- ghostscript-9.00/base/gximag3x.c	Tue Aug 10 09:20:19 2010
++++ ghostscript-9.00/base/gximag3x.c	Mon Oct  8 03:56:41 2012
+@@ -546,6 +546,12 @@
+ 	return_error(gs_error_VMerror);
+     gx_device_bbox_init(bbdev, dev, mem);
+     gx_device_bbox_fwd_open_close(bbdev, false);
++
++    if (dev->device_icc_profile) {
++        bbdev->device_icc_profile = dev->device_icc_profile;
++        rc_increment(bbdev->device_icc_profile);
++    }
++
+     code = dev_proc(bbdev, begin_typed_image)
+ 	((gx_device *)bbdev, pis, pmat, pic, prect, pdcolor, pcpath, mem,
+ 	 pinfo);
+@@ -854,6 +860,11 @@
+     gx_device *pcdev = penum->pcdev;
+     int pcode = gx_image_end(penum->pixel.info, draw_last);
+ 
++    if (pcdev->device_icc_profile) {
++        rc_decrement(pcdev->device_icc_profile, "gx_image3x_end_image");
++        pcdev->device_icc_profile = NULL;
++    }
++
+     gs_closedevice(pcdev);
+     if (mdev0)
+ 	gs_closedevice(mdev0);
+--- ghostscript-9.00/base/gslib.c	Tue May  4 11:47:12 2010
++++ ghostscript-9.00/base/gslib.c	Mon Oct  8 03:57:33 2012
+@@ -178,6 +178,11 @@
+ 	ht.spot_function = odsf;
+ 	gs_setscreen(pgs, &ht);
+     }
++
++    code = gsicc_init_device_profile(pgs, dev);
++    if (code < 0)
++        return code;
++
+     /* gsave and grestore (among other places) assume that */
+     /* there are at least 2 gstates on the graphics stack. */
+     /* Ensure that now. */
+@@ -197,6 +202,11 @@
+ 	dprintf1("**** Test returned code = %d.\n", code);
+     dputs("Done.  Press <enter> to exit.");
+     fgetc(mem->gs_lib_ctx->fstdin);
++    if (dev->device_icc_profile) {
++        rc_decrement(dev->device_icc_profile, "gslib main");
++        dev->device_icc_profile = NULL;
++    }
++
+     gs_lib_finit(0, 0, mem);
+     return 0;
+ #undef mem
+--- ghostscript-9.00/base/gdevvec.c	Thu Dec  3 16:33:04 2009
++++ ghostscript-9.00/base/gdevvec.c	Mon Oct  8 03:34:56 2012
+@@ -326,6 +326,11 @@
+ 		     dev_proc(vdev, get_initial_matrix));
+ 	(*dev_proc(vdev->bbox_device, open_device))
+ 	    ((gx_device *) vdev->bbox_device);
++
++	if (vdev->device_icc_profile) {
++	    vdev->bbox_device->device_icc_profile = vdev->device_icc_profile;
++	    rc_increment(vdev->bbox_device->device_icc_profile);
++	}
+     }
+     return 0;
+ }
+@@ -802,6 +807,11 @@
+     FILE *f = vdev->file;
+     int err;
+ 
++    if (vdev->bbox_device && vdev->bbox_device->device_icc_profile) {
++        rc_decrement(vdev->bbox_device->device_icc_profile, "gdev_vector_close_file");
++        vdev->bbox_device->device_icc_profile = NULL;
++    }
++
+     gs_free_object(vdev->v_memory, vdev->bbox_device,
+ 		   "vector_close(bbox_device)");
+     vdev->bbox_device = 0;