summaryrefslogtreecommitdiffstats
path: root/src/H5T.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5T.c')
-rw-r--r--src/H5T.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/H5T.c b/src/H5T.c
index 240b8c7..8211a93 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -3082,7 +3082,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;
@@ -3101,10 +3101,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:
@@ -3132,7 +3128,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);
@@ -3176,6 +3172,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:
{
@@ -3539,7 +3539,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)