[gs-bugs] [Bug 690572] reference counting problem with devices & patterns

bugzilla-daemon at ghostscript.com bugzilla-daemon at ghostscript.com
Thu May 20 14:39:53 UTC 2010


--- Comment #16 from Ken Sharp <ken.sharp at artifex.com> 2010-05-20 14:39:50 UTC ---
Created an attachment (id=6307)
 --> (http://bugs.ghostscript.com/attachment.cgi?id=6307)
patch to address reference counting

The attached patch addresses the problem for me. In
gx_dc_pattern_fill_rectangle, before calling the initialisation routine, it
initialises the clip device finalize routine to NULL. 

If the initialisation decides that we need to clip the pattern fill, then it
will create and open a clip device, storing the device in 'state.cdev'. If we
do not need to clip the pattern fill then the clip device remains untounched.

At the end of the routine the clip device finalize routine will either be NULL
(not clipping) or will have been set by the open device call. If the routine is
not NULL then we call the finalize routine. This then counts down the reference
to the forwarded device (pdfwrite in this case).

This works for me, and a cluster test appears to be OK, the only differences
being more or less expected pdfwrite ones. I believe this is safe, but I'd very
much appreciate someone else (Henry ?) looking at this as well.

For me this prevents pdfwrite emitting unfinished PDF files for:

Which isn't to say that they are without problems, but they do partially work
which is an improvement.

Configure bugmail: http://bugs.ghostscript.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

More information about the gs-bugs mailing list