summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5T.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/H5T.c b/src/H5T.c
index c726e5c..2da5be4 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -3080,7 +3080,7 @@ H5T_t *
H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
{
H5T_t *new_dt = NULL, *tmp = NULL;
- H5T_shared_t *reopened_fo;
+ H5T_shared_t *reopened_fo = NULL;
unsigned i;
char *s;
H5T_t *ret_value;
@@ -3099,10 +3099,6 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
/* Copy shared information (entry information is copied last) */
*(new_dt->shared) = *(old_dt->shared);
- /* Copy parent information */
- if(new_dt->shared->parent)
- new_dt->shared->parent = H5T_copy(new_dt->shared->parent, method);
-
/* Check what sort of copy we are making */
switch (method) {
case H5T_COPY_TRANSIENT:
@@ -3130,7 +3126,7 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
*/
if(old_dt->sh_loc.type == H5O_SHARE_TYPE_COMMITTED) {
/* Check if the object is already open */
- if((reopened_fo = H5FO_opened(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr)) == NULL) {
+ if(NULL == (reopened_fo = H5FO_opened(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr))) {
/* Clear any errors from H5FO_opened() */
H5E_clear_stack(NULL);
@@ -3174,6 +3170,10 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
break;
} /* end switch */
+ /* Copy parent information, if we aren't sharing an already opened committed datatype */
+ if(NULL == reopened_fo && old_dt->shared->parent)
+ new_dt->shared->parent = H5T_copy(old_dt->shared->parent, method);
+
switch(new_dt->shared->type) {
case H5T_COMPOUND:
{
@@ -3537,7 +3537,8 @@ H5T_close(H5T_t *dt)
HDassert(dt && dt->shared);
- dt->shared->fo_count--;
+ if(dt->shared->state == H5T_STATE_OPEN)
+ dt->shared->fo_count--;
if(dt->shared->state != H5T_STATE_OPEN || dt->shared->fo_count == 0) {
if(H5T_free(dt) < 0)