summaryrefslogtreecommitdiffstats
path: root/src/H5A.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5A.c')
-rw-r--r--src/H5A.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/H5A.c b/src/H5A.c
index 0b846d8..e4300d5 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -383,6 +383,16 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
attr->dt_size = H5O_msg_raw_size(attr->oloc.file, H5O_DTYPE_ID, attr->dt);
} /* end if */
else if(tri_ret > 0) {
+ /* Check whether datatype is committed & increment ref count */
+ /* (to maintain ref. count incr/decr similarity with "shared message"
+ * type of datatype sharing)
+ */
+ if(H5T_committed(attr->dt)) {
+ /* Increment the reference count on the shared datatype */
+ if(H5T_link(attr->dt, 1, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared datatype link count")
+ } /* end if */
+
/* Message is shared. Use size of shared message */
if(NULL == H5O_msg_get_share(H5O_DTYPE_ID, attr->dt, &sh_mesg))
HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "couldn't get size of shared message")