summaryrefslogtreecommitdiffstats
path: root/src/H5VL.c
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2012-03-29 15:58:51 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2012-03-29 15:58:51 (GMT)
commit772133345d8d685e236b803f57189be0e042ca03 (patch)
tree9b3c7ace15a41e5101ca8b30e125100407178fdb /src/H5VL.c
parent63ead111fad0e28e95c84bab134e149f4e8cd0d0 (diff)
downloadhdf5-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.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/H5VL.c b/src/H5VL.c
index d6696f0..ffe9cc3 100644
--- a/src/H5VL.c
+++ b/src/H5VL.c
@@ -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() */