diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2012-03-29 15:58:51 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2012-03-29 15:58:51 (GMT) |
commit | 772133345d8d685e236b803f57189be0e042ca03 (patch) | |
tree | 9b3c7ace15a41e5101ca8b30e125100407178fdb /src/H5VL.c | |
parent | 63ead111fad0e28e95c84bab134e149f4e8cd0d0 (diff) | |
download | hdf5-772133345d8d685e236b803f57189be0e042ca03.zip hdf5-772133345d8d685e236b803f57189be0e042ca03.tar.gz hdf5-772133345d8d685e236b803f57189be0e042ca03.tar.bz2 |
[svn-r22184] - make the H5I inc and dec ref count routines independent of the VOL wrapper id
- change the free function for the VOL wrapper ID to also dec the ref count of the object ID to 0
Diffstat (limited to 'src/H5VL.c')
-rw-r--r-- | src/H5VL.c | 23 |
1 files changed, 19 insertions, 4 deletions
@@ -228,17 +228,32 @@ done: static herr_t H5VL_free_id_wrapper(H5VL_id_wrapper_t *id_struct) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + int ref_count; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT /* Sanity check */ HDassert(id_struct); + /* If we are freeing the id wrapper, then we need to call the free + callback on the object ID in this wrapper, so just keep + decrementing the ref count on the object id till it gets to 0 + and calls its free function */ + ref_count = H5I_get_ref(id_struct->obj_id, TRUE); + while (ref_count > 0) { + if((ref_count = H5I_dec_app_ref(id_struct->obj_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't free") + } + + /* decrement the number of reference on the VOL plugin */ + id_struct->vol_plugin->nrefs --; + /* free the ID wrapper */ H5MM_xfree(id_struct); - /* MSC need to decrement the ref count on the VOL struct */ - - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_free_id_wrapper() */ |