[gs-cvs] rev 8498 - trunk/gs/src
leonardo at ghostscript.com
leonardo at ghostscript.com
Wed Jan 23 05:30:39 PST 2008
Author: leonardo
Date: 2008-01-23 05:30:39 -0800 (Wed, 23 Jan 2008)
New Revision: 8498
Modified:
trunk/gs/src/gsptype2.c
trunk/gs/src/lib.mak
Log:
Fix (shadings) : A memory deallocation problem.
DETAILS :
Bug 689660 "memory deallication problems with shadings".
The old code used pdev->memory for temporary storing
an intersection of clipping path with shading bbox.
This is the global memory space.
However if the intersection is trivial,
the path of the clipping path is copied from the
original clipping path, which is allocated in the local memory space.
Later it causes a freeing of path segments to a wrong memory space.
This patch chooses the original clipping path's memory space
when the clipping path is available, and the global space otherwise.
EXPECTED DIFFERENCES :
None.
Modified: trunk/gs/src/gsptype2.c
===================================================================
--- trunk/gs/src/gsptype2.c 2008-01-23 13:23:09 UTC (rev 8497)
+++ trunk/gs/src/gsptype2.c 2008-01-23 13:30:39 UTC (rev 8498)
@@ -25,6 +25,7 @@
#include "gxpcolor.h"
#include "gxstate.h" /* for gs_state_memory */
#include "gzpath.h"
+#include "gzcpath.h"
#include "gzstate.h"
/* GC descriptors */
@@ -331,16 +332,17 @@
(*dev_proc(pdev, pattern_manage))(pdev, gs_no_id, NULL, pattern_manage__shading_area) == 0) {
gs_pattern2_instance_t *pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern;
gx_path box_path;
+ gs_memory_t *mem = (*ppcpath1 != NULL ? (*ppcpath1)->path.memory : pdev->memory);
int code;
- gx_path_init_local(&box_path, pdev->memory);
+ gx_path_init_local(&box_path, mem);
code = gx_dc_shading_path_add_box(&box_path, pdevc);
if (code == gs_error_limitcheck) {
/* Ignore huge BBox - bug 689027. */
code = 0;
} else {
if (code >= 0) {
- gx_cpath_init_local_shared(cpath_local, *ppcpath1, pdev->memory);
+ gx_cpath_init_local_shared(cpath_local, *ppcpath1, mem);
code = gx_cpath_intersect(cpath_local, &box_path, gx_rule_winding_number, (gs_imager_state *)pinst->saved);
*ppcpath1 = cpath_local;
}
Modified: trunk/gs/src/lib.mak
===================================================================
--- trunk/gs/src/lib.mak 2008-01-23 13:23:09 UTC (rev 8497)
+++ trunk/gs/src/lib.mak 2008-01-23 13:30:39 UTC (rev 8498)
@@ -2599,7 +2599,7 @@
$(GLOBJ)gsptype2.$(OBJ) : $(GLSRC)gsptype2.c $(GXERR)\
$(gscspace_h) $(gsshade_h) $(gsmatrix_h) $(gsstate_h)\
$(gxcolor2_h) $(gxdcolor_h) $(gsptype2_h) $(gxpcolor_h)\
- $(gxstate_h) $(gzpath_h) $(gzstate_h)
+ $(gxstate_h) $(gzpath_h) $(gzcpath_h) $(gzstate_h)
$(GLCC) $(GLO_)gsptype2.$(OBJ) $(C_) $(GLSRC)gsptype2.c
$(GLOBJ)gsshade.$(OBJ) : $(GLSRC)gsshade.c $(GXERR)\
More information about the gs-cvs
mailing list