subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1586467 - in /subversion/trunk/subversion/bindings/swig: ruby/test/test_client.rb svn_client.i
Date Thu, 10 Apr 2014 20:51:06 GMT
Author: stsp
Date: Thu Apr 10 20:51:06 2014
New Revision: 1586467

URL: http://svn.apache.org/r1586467
Log:
Fix a pool lifetime issue in the ruby bindings.

* subversion/bindings/swig/svn_client.i
  (svn_client_ctx_t): Use svn_client_create_context2() instead of the
   deprecated svn_client_create_context(). Obtain a config hash from
   svn_config_get_config() and pass it to svn_client_create_context2().
  (svn_client_set_config): Copy the provided config into ctx->config.
   This ensures proper lifetime of ctx->config. For some reason the
   'config' data provided to this function had been freed by the time
   the test suite reached the svn_client_get_config() function.
   Copying the provided data into the pool of ctx->config fixes the problem.

* subversion/bindings/swig/ruby/test/test_client.rb
  (test_set_config): Don't expect ctx.config to be nil anymore after
   the context is created. It is now equal to the default configuration.

Modified:
    subversion/trunk/subversion/bindings/swig/ruby/test/test_client.rb
    subversion/trunk/subversion/bindings/swig/svn_client.i

Modified: subversion/trunk/subversion/bindings/swig/ruby/test/test_client.rb
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/ruby/test/test_client.rb?rev=1586467&r1=1586466&r2=1586467&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/ruby/test/test_client.rb (original)
+++ subversion/trunk/subversion/bindings/swig/ruby/test/test_client.rb Thu Apr 10 20:51:06
2014
@@ -2267,7 +2267,6 @@ class SvnClientTest < Test::Unit::TestCa
         end
       end
       config = Svn::Core::Config.config(@config_path)
-      assert_nil(ctx.config)
       assert_equal(options, config[Svn::Core::CONFIG_CATEGORY_SERVERS].to_hash)
       ctx.config = config
       assert_equal(options,

Modified: subversion/trunk/subversion/bindings/swig/svn_client.i
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/svn_client.i?rev=1586467&r1=1586466&r2=1586467&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/svn_client.i (original)
+++ subversion/trunk/subversion/bindings/swig/svn_client.i Thu Apr 10 20:51:06 2014
@@ -395,7 +395,13 @@ Callback: svn_client_diff_summarize_func
   svn_client_ctx_t(apr_pool_t *pool) {
     svn_error_t *err;
     svn_client_ctx_t *self;
-    err = svn_client_create_context(&self, pool);
+    apr_hash_t *cfg_hash;
+
+    err = svn_config_get_config(&cfg_hash, NULL, pool);
+    if (err)
+      svn_swig_rb_handle_svn_error(err);
+
+    err = svn_client_create_context2(&self, cfg_hash, pool);
     if (err)
       svn_swig_rb_handle_svn_error(err);
     return self;
@@ -512,7 +518,13 @@ svn_client_set_config(svn_client_ctx_t *
                       apr_hash_t *config,
                       apr_pool_t *pool)
 {
-  ctx->config = config;
+  svn_error_t *err;
+
+  apr_hash_clear(ctx->config);
+  err = svn_config_copy_config(&ctx->config, config,
+                               apr_hash_pool_get(ctx->config));
+  if (err)
+    svn_swig_rb_handle_svn_error(err);
   return Qnil;
 }
 



Mime
View raw message