summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2010-09-07 15:41:55 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2010-09-07 15:41:55 (GMT)
commitad0134f2a6bbe271302b36856d6b9e2e0898264c (patch)
treea5295be9757527a5ef1db5d8b9e34fd283ec2d8f /src
parentc5bfe49ea68cb324f1ed608083de36071bbe2a24 (diff)
downloadhdf5-ad0134f2a6bbe271302b36856d6b9e2e0898264c.zip
hdf5-ad0134f2a6bbe271302b36856d6b9e2e0898264c.tar.gz
hdf5-ad0134f2a6bbe271302b36856d6b9e2e0898264c.tar.bz2
[svn-r19354] Quincey and I made H5Eset_current_stack also close the stack to be set. This is to avoid
H5Eclose_stack clearing the default stack. Please see bug 1799. Tested on jam - simple change.
Diffstat (limited to 'src')
-rw-r--r--src/H5E.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/H5E.c b/src/H5E.c
index 7c34add..b90caff 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -1000,13 +1000,19 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Eset_current_stack
*
- * Purpose: Replaces current stack with specified stack.
+ * Purpose: Replaces current stack with specified stack. This closes the
+ * stack ID also.
*
* Return: Non-negative value on success/Negative on failure
*
* Programmer: Raymond Lu
* Friday, July 15, 2003
*
+ * Modification:
+ * Raymond Lu
+ * 7 September 2010
+ * Also closes the stack to avoid potential problem (bug 1799)
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1025,6 +1031,13 @@ H5Eset_current_stack(hid_t err_stack)
/* Set the current error stack */
if(H5E_set_current_stack(estack) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "unable to set error stack")
+
+ /*
+ * Decrement the counter on the error stack. It will be freed if the count
+ * reaches zero.
+ */
+ if(H5I_dec_ref(err_stack, TRUE) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error stack")
} /* end if */
done: