On Thu, 25 Sep 2003, Randy Kobes wrote:

> Might this have something to do with the comment in
> apr_pools.h:
[ ... ]
> in that the key must be unique for both pools and subpools?
> I tried the following:
> ===========================================================
> Index: xs/APR/Pool/APR__Pool.h
> ===================================================================
> RCS file: /home/cvs/modperl-2.0/xs/APR/Pool/APR__Pool.h,v
> retrieving revision 1.6
> diff -u -r1.6 APR__Pool.h
> --- xs/APR/Pool/APR__Pool.h   9 Sep 2003 17:22:39 -0000       1.6
> +++ xs/APR/Pool/APR__Pool.h   25 Sep 2003 04:56:59 -0000
> @@ -1,4 +1,5 @@
>  #define MP_APR_POOL_NEW "APR::Pool::new"
> +#define MP_APR_SUBPOOL_NEW "APR::SubPool::new"
>
>  /**
>   * create a new pool or subpool
> @@ -9,11 +10,12 @@
>  {
>      apr_pool_t *parent = mpxs_sv_object_deref(obj, apr_pool_t);
>      apr_pool_t *newpool = NULL;
> +    const char *key = parent ? MP_APR_SUBPOOL_NEW : MP_APR_POOL_NEW;
>      (void)apr_pool_create(&newpool, parent);
>
>      /* mark the pool as being created via APR::Pool->new()
>       * see mpxs_apr_pool_DESTROY */
> -    apr_pool_userdata_set((const void *)1, MP_APR_POOL_NEW,
> +    apr_pool_userdata_set((const void *)1, key,
>                            apr_pool_cleanup_null, newpool);
>
>      return newpool;
> @@ -119,6 +121,7 @@
>
>      void *flag;
>      apr_pool_t *p;
> +    const char *key;
>
>      /* APR::Pool::DESTROY
>       * we only want to call DESTROY on objects created by
> @@ -127,8 +130,9 @@
>       * apr_pool_destroy ($p->destroy) */
>
>      p = mpxs_sv_object_deref(obj, apr_pool_t);
> +    key = p ? MP_APR_SUBPOOL_NEW : MP_APR_POOL_NEW;
>
> -    apr_pool_userdata_get(&flag, MP_APR_POOL_NEW, p);
> +    apr_pool_userdata_get(&flag, key, p);
>
>      if (flag) {
>           apr_pool_destroy(p);
> ===============================================================
> which is intended to give a different key to a parent and
> to a subpool. Running
>     perl -Mblib t/TEST t/api t/apr t/filter
> got some failures in apr/pool (subtests 6-13), but all
> the filter tests passed.

I'm not sure if this helps, but I tried instead of the
above the following:
=============================================================
Index: xs/APR/Pool/APR__Pool.h
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/APR/Pool/APR__Pool.h,v
retrieving revision 1.6
diff -u -r1.6 APR__Pool.h
--- xs/APR/Pool/APR__Pool.h     9 Sep 2003 17:22:39 -0000       1.6
+++ xs/APR/Pool/APR__Pool.h     25 Sep 2003 06:50:44 -0000
@@ -1,4 +1,5 @@
 #define MP_APR_POOL_NEW "APR::Pool::new"
+#define MP_APR_SUBPOOL_NEW "APR::SubPool::new"

 /**
  * create a new pool or subpool
@@ -9,11 +10,12 @@
 {
     apr_pool_t *parent = mpxs_sv_object_deref(obj, apr_pool_t);
     apr_pool_t *newpool = NULL;
+    const char *key = parent ? MP_APR_SUBPOOL_NEW : MP_APR_POOL_NEW;
     (void)apr_pool_create(&newpool, parent);

     /* mark the pool as being created via APR::Pool->new()
      * see mpxs_apr_pool_DESTROY */
-    apr_pool_userdata_set((const void *)1, MP_APR_POOL_NEW,
+    apr_pool_userdata_set((const void *)1, key,
                           apr_pool_cleanup_null, newpool);

     return newpool;
==================================================================
(ie, leave the original key in mpxs_apr_pool_DESTROY as
MP_APR_POOL_NEW alone) - in this case, the apr/pool tests
pass, as did all the filter tests. However, running the
tests all together resulted in a problem with the
modules/include test crashing (but these passed
if run just by themselves).

-- 
best regards,
randy

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to