summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Johnston <ray.johnston@artifex.com>2012-05-09 09:51:11 -0700
committerRay Johnston <ray.johnston@artifex.com>2012-05-09 09:51:11 -0700
commitaf974d1bd4b4f0470e77d28eb0cdcb72def2de76 (patch)
tree44123b197963fa76bd6690124b6861b48458ecec
parent0ee6bd45c59c2ae99ec30cba4dae22d1f2e20dc4 (diff)
Revert "Fix bug 692372: Add finalize for imager_state to ref_count decrement icc structs."
This reverts commit fe8d7b6aebfed3c724a860e31ff170764d5429dc. This commit resulted in a subsantial memory leak detected with PCL. See bug 693001. The finalization should be for the icc structs that have semaphores.
-rw-r--r--gs/base/gsicc_profilecache.c5
-rw-r--r--gs/base/gsistate.c22
-rw-r--r--gs/base/gsstate.c1
-rw-r--r--gs/base/gxistate.h6
-rw-r--r--gs/base/gzstate.h5
5 files changed, 8 insertions, 31 deletions
diff --git a/gs/base/gsicc_profilecache.c b/gs/base/gsicc_profilecache.c
index 80ec78fe3..fcf01bdd7 100644
--- a/gs/base/gsicc_profilecache.c
+++ b/gs/base/gsicc_profilecache.c
@@ -66,15 +66,14 @@ static void
rc_gsicc_profile_cache_free(gs_memory_t * mem, void *ptr_in, client_name_t cname)
{
gsicc_profile_cache_t *profile_cache = (gsicc_profile_cache_t * ) ptr_in;
- gsicc_profile_entry_t *curr = profile_cache->head, *next;
+ gsicc_profile_entry_t *curr = profile_cache->head;
while (curr != NULL ){
- next = curr->next;
rc_decrement(curr->color_space, "rc_gsicc_profile_cache_free");
gs_free_object(mem->stable_memory, curr,
"rc_gsicc_profile_cache_free");
profile_cache->num_entries--;
- curr = next;
+ curr = curr->next;
}
#ifdef DEBUG
if (profile_cache->num_entries != 0)
diff --git a/gs/base/gsistate.c b/gs/base/gsistate.c
index c645ea2b9..ea2b8ac09 100644
--- a/gs/base/gsistate.c
+++ b/gs/base/gsistate.c
@@ -61,7 +61,6 @@ private_st_line_params();
* pointers are handled in this manner.
*/
public_st_imager_state();
-
static
ENUM_PTRS_BEGIN(imager_state_enum_ptrs)
ENUM_SUPER(gs_imager_state, st_line_params, line_params, st_imager_state_num_ptrs - st_line_params_num_ptrs);
@@ -221,8 +220,7 @@ gs_imager_state_release(gs_imager_state * pis)
gx_device_halftone *pdht = pis->dev_ht;
#define RCDECR(element)\
- rc_decrement(pis->element, cname);\
- pis->element = NULL; /* clear the pointer to prevent multiple decrements */
+ rc_decrement(pis->element, cname)
RCDECR(cie_joint_caches);
RCDECR(set_transfer.gray);
@@ -246,23 +244,5 @@ gs_imager_state_release(gs_imager_state * pis)
RCDECR(icc_link_cache);
RCDECR(icc_profile_cache);
RCDECR(icc_manager);
-}
-
-/* release the parts of the imager_state when it is freed */
-void
-gs_imager_state_finalize(const gs_memory_t *mem, void *ptr)
-{
- const char *const cname = "gs_imager_state_finalize";
- gs_imager_state *pis = (gs_imager_state *)ptr;
-
- /* we really ought to be able to use gs_imager_state_release, but the */
- /* other elements in the imager state are not properly reference counted. */
- /* At least these three elements are correct in that the final free as a */
- /* part of 'alloc_restore_all' is what decrements these to 0 and frees */
- /* these elements. Important since some have semaphores and we must call */
- /* gx_semaphore_free to release the handles on Windows. */
- RCDECR(icc_link_cache);
- RCDECR(icc_profile_cache);
- RCDECR(icc_manager);
#undef RCDECR
}
diff --git a/gs/base/gsstate.c b/gs/base/gsstate.c
index 9859fa822..be2a19b24 100644
--- a/gs/base/gsstate.c
+++ b/gs/base/gsstate.c
@@ -1044,6 +1044,7 @@ gstate_free_contents(gs_state * pgs)
(*pgs->client_procs.free) (pgs->client_data, mem);
gs_free_object(mem, pgs->line_params.dash.pattern, cname);
gstate_free_parts(pgs, mem, cname);
+ gs_imager_state_release((gs_imager_state *)pgs);
}
/* Copy one gstate to another. */
diff --git a/gs/base/gxistate.h b/gs/base/gxistate.h
index e1dc2158c..af21da6f1 100644
--- a/gs/base/gxistate.h
+++ b/gs/base/gxistate.h
@@ -305,11 +305,9 @@ struct gs_imager_state_s {
gx_default_get_cmap_procs
/* The imager state structure is public only for subclassing. */
-
-struct_proc_finalize(gs_imager_state_finalize);
#define public_st_imager_state() /* in gsistate.c */\
- gs_public_st_composite_use_final(st_imager_state, gs_imager_state, "gs_imager_state",\
- imager_state_enum_ptrs, imager_state_reloc_ptrs, gs_imager_state_finalize)
+ gs_public_st_composite(st_imager_state, gs_imager_state, "gs_imager_state",\
+ imager_state_enum_ptrs, imager_state_reloc_ptrs)
/* Initialize an imager state, other than the parts covered by */
/* gs_imager_state_initial. */
diff --git a/gs/base/gzstate.h b/gs/base/gzstate.h
index 4217edbb6..220cc4fa2 100644
--- a/gs/base/gzstate.h
+++ b/gs/base/gzstate.h
@@ -149,10 +149,9 @@ struct gs_state_s {
gs_state_client_procs client_procs;
};
-struct_proc_finalize(gs_imager_state_finalize);
#define public_st_gs_state() /* in gsstate.c */\
- gs_public_st_composite_use_final(st_gs_state, gs_state, "gs_state",\
- gs_state_enum_ptrs, gs_state_reloc_ptrs, gs_imager_state_finalize)
+ gs_public_st_composite(st_gs_state, gs_state, "gs_state",\
+ gs_state_enum_ptrs, gs_state_reloc_ptrs)
/*
* Enumerate the pointers in a graphics state, other than the ones in the