perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: [mp2] pool object dependant methods insanity
Date Fri, 24 Dec 2004 05:31:32 GMT
mpxs_Apache__RequestRec_new is another problematic method. it segfaults if 
adding a magic:

Index: xs/Apache/RequestUtil/Apache__RequestUtil.h
===================================================================
--- xs/Apache/RequestUtil/Apache__RequestUtil.h (revision 123255)
+++ xs/Apache/RequestUtil/Apache__RequestUtil.h (working copy)
@@ -54,17 +54,21 @@
   */

  static MP_INLINE
-request_rec *mpxs_Apache__RequestRec_new(SV *classname,
-                                         conn_rec *c,
-                                         apr_pool_t *base_pool)
+SV *mpxs_Apache__RequestRec_new(pTHX_ SV *classname,
+                                conn_rec *c,
+                                SV *base_pool_sv)
  {
-    apr_pool_t *p;
+    apr_pool_t *p, *base_pool;
      request_rec *r;
      server_rec *s = c->base_server;
-
+    SV *r_sv;
+
      /* see: httpd-2.0/server/protocol.c:ap_read_request */

-    if (!base_pool) {
+    if (base_pool_sv) {
+        base_pool = mp_xs_sv2_APR__Pool(base_pool_sv);
+    }
+    else {
          base_pool = c->pool;
      }

@@ -113,7 +117,13 @@
      r->assbackwards    = 1;
      r->protocol        = "UNKNOWN";

-    return r;
+    r_sv = sv_setref_pv(NEWSV(0, 0), "Apache::RequestRec", (void*)r);
+
+    if (base_pool_sv) {
+        mpxs_add_pool_magic(r_sv, base_pool_sv);
+    }
+
+    return r_sv;
  }

  static MP_INLINE


I'm also thinking whether we should do that magic decorating only for 
custom pools or for native pools as well. I think this should be done only 
for custom pools, since native pools destruction timing is not under our 
control anyway.


-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message