You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by st...@apache.org on 2002/04/01 18:09:47 UTC
cvs commit: httpd-2.0/modules/experimental mod_mem_cache.c
stoddard 02/04/01 08:09:47
Modified: modules/experimental mod_mem_cache.c
Log:
If this is a subrequest, register the cleanup against
the main request. This will prevent the cache object
from being cleaned up from under the request after the
subrequest is destroyed.
Revision Changes Path
1.43 +13 -1 httpd-2.0/modules/experimental/mod_mem_cache.c
Index: mod_mem_cache.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_mem_cache.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- mod_mem_cache.c 29 Mar 2002 08:17:21 -0000 1.42
+++ mod_mem_cache.c 1 Apr 2002 16:09:46 -0000 1.43
@@ -429,12 +429,24 @@
APR_HASH_KEY_STRING);
if (obj) {
if (obj->complete) {
+ request_rec *rmain, *rtmp;
+
#ifdef USE_ATOMICS
apr_atomic_inc(&obj->refcount);
#else
obj->refcount++;
#endif
- apr_pool_cleanup_register(r->pool, obj, decrement_refcount,
+ /* If this is a subrequest, register the cleanup against
+ * the main request. This will prevent the cache object
+ * from being cleaned up from under the request after the
+ * subrequest is destroyed.
+ */
+ rtmp = r;
+ while (rtmp) {
+ rmain = rtmp;
+ rtmp = rmain->main;
+ }
+ apr_pool_cleanup_register(rmain->pool, obj, decrement_refcount,
apr_pool_cleanup_null);
}
else {