[gs-cvs] rev 7092 - trunk/gs/src

stefan at ghostscript.com stefan at ghostscript.com
Fri Oct 6 08:25:15 PDT 2006


Author: stefan
Date: 2006-10-06 08:25:15 -0700 (Fri, 06 Oct 2006)
New Revision: 7092

Modified:
   trunk/gs/src/gxidata.c
Log:
Merge from pcl tree.

The freeing of the rop_dev and clip_dev in an image enum now 
unhooks forwarding devices prior to freeing otherwise there 
are memory leaks.

The rational behind the direct frees used here verses 
the more normal reference counting of graphic library objects 
has apparently been lost.  



Modified: trunk/gs/src/gxidata.c
===================================================================
--- trunk/gs/src/gxidata.c	2006-10-06 15:20:13 UTC (rev 7091)
+++ trunk/gs/src/gxidata.c	2006-10-06 15:25:15 UTC (rev 7092)
@@ -428,8 +428,17 @@
 	if (code < 0)
 	    return code;
     }
+
+   /* release the reference to the target */
+    if ( penum->rop_dev )
+        gx_device_set_target((gx_device_forward *)penum->rop_dev, NULL);
+    if ( penum->clip_dev )
+        gx_device_set_target((gx_device_forward *)penum->clip_dev, NULL);
+    /* it is not clear (to me) why these are freed explicitly instead
+       of using reference counting */
     gs_free_object(mem, penum->rop_dev, "image RasterOp");
     gs_free_object(mem, penum->clip_dev, "image clipper");
+
     if (scaler != 0) {
 	(*scaler->template->release) ((stream_state *) scaler);
 	gs_free_object(mem, scaler, "image scaler state");



More information about the gs-cvs mailing list