subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hwri...@apache.org
Subject svn commit: r1211162 - /subversion/trunk/subversion/libsvn_wc/context.c
Date Tue, 06 Dec 2011 21:22:08 GMT
Author: hwright
Date: Tue Dec  6 21:22:08 2011
New Revision: 1211162

URL: http://svn.apache.org/viewvc?rev=1211162&view=rev
Log:
Fix a potential memory cleanup ordering bug.

* subversion/libsvn_wc/context.c
  (svn_wc_context_create): Use an improved pool cleanup method, if available.

Modified:
    subversion/trunk/subversion/libsvn_wc/context.c

Modified: subversion/trunk/subversion/libsvn_wc/context.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/context.c?rev=1211162&r1=1211161&r2=1211162&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/context.c (original)
+++ subversion/trunk/subversion/libsvn_wc/context.c Tue Dec  6 21:22:08 2011
@@ -28,6 +28,8 @@
 #include "svn_dirent_uri.h"
 #include "svn_path.h"
 
+#include "private/svn_dep_compat.h"
+
 #include "wc.h"
 #include "wc_db.h"
 
@@ -71,8 +73,21 @@ svn_wc_context_create(svn_wc_context_t *
                           TRUE, TRUE, ctx->state_pool, scratch_pool));
   ctx->close_db_on_destroy = TRUE;
 
+  /* We should be doing this cleanup prior to the subpools actually getting
+     cleaned up, because chances are that our various data structures and DB
+     handles live in those subpools, which we could be invalidating.
+     Unfortunately, the pre-cleanup handler is only available in APR >= 1.3.0,
+     but most of the platforms we're running on these days probably have that
+     installed anyway.
+
+     This problem manifests itself via segfault when running against an APR
+     compiled with pool lifetime debugging. */
+#if APR_VERSION_AT_LEAST(1, 3, 0)
+  apr_pool_pre_cleanup_register(result_pool, ctx, close_ctx_apr);
+#else
   apr_pool_cleanup_register(result_pool, ctx, close_ctx_apr,
                             apr_pool_cleanup_null);
+#endif
 
   *wc_ctx = ctx;
 



Mime
View raw message