[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

segfault at exit -- can anyone spot what I'm doing wrong?

From: Davyd McColl <davydm_at_gmail.com>
Date: Wed, 27 May 2009 22:24:48 +0200

Good day

I have some C++ code which uses the svn_fs_* functions. I've noticed a bit
of an oddity, and I'm hoping that someone can just tell me that I'm
forgetting to do something. It seems that when I try to perform functions on
dirs or files in the repo, if I specify a path that doesn't exist in the
repo, I don't just get failure for the called function -- I also get a
segfault in apr_terminate() when the last call is made to apr_terminate()
(as I understand it, the last call in a stack of apr_initalize()[*N*]
apr_terminate()[*N*] is the one called...

A simple code example:

    const char *szPath = "/";
    apr_initialize();
    apr_pool_t *pt = svn_pool_create(NULL);
    svn_fs_initialize(pt);
    svn_repos_t *repo;
    svn_repos_open(&repo, argv[REPO_ARG], pt);
    svn_fs_t *fs = svn_repos_fs(repo);
    svn_fs_root_t *root;
    svn_fs_revision_root(&root, fs, 1, pt);

    apr_pool_t *ptSub = svn_pool_create(pt);
    apr_hash_t *hash;
    svn_fs_dir_entries(&hash, root, szPath, ptSub);

    svn_pool_destroy(ptSub);
    svn_pool_destroy(pt);
    apr_terminate();
    return 0;

With szPath set to "/" as above, all works as expected and the application
exits cleanly. However, if szPath were set to a path not available in the
repo at the revision set (for example, if I set the path to "/foobar"), then
not only does the svn_fs_dir_entries() call fail (yes, I know I'm not
checking for the error here, but I know it does fail -- and I really
couldn't expect otherwise for a path not in the repo...), but when the time
comes for the apr_terminate() call, the application segfaults.

I'm using subversion-1.6.1, compiled from source on my own machine with
Visual Studio 2008. I'm assuming that there's some crucial step that I'm
missing out in the code above and would dearly appreciate any constructive
thoughts on the problem

-d

-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Truth doesn't cease to be just because you don't agree with it.
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2355925
To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-05-27 22:26:16 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.