summaryrefslogtreecommitdiffstats
path: root/src/H5HG.c
diff options
context:
space:
mode:
authorSongyu Lu <songyulu@hdfgroup.org>2018-11-30 15:02:03 (GMT)
committerSongyu Lu <songyulu@hdfgroup.org>2018-11-30 15:02:03 (GMT)
commita89130553de2d043eb69b65d75162af5b97df3bf (patch)
treef4d75ade00d6be5d9f84a50eab51927aac1ffb79 /src/H5HG.c
parent9c7161e105aaade595c4f382e76ec3b95990ae91 (diff)
downloadhdf5-a89130553de2d043eb69b65d75162af5b97df3bf.zip
hdf5-a89130553de2d043eb69b65d75162af5b97df3bf.tar.gz
hdf5-a89130553de2d043eb69b65d75162af5b97df3bf.tar.bz2
HDFFV-10635: Allowing to write the same variable-length element more than once.
Diffstat (limited to 'src/H5HG.c')
-rw-r--r--src/H5HG.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/H5HG.c b/src/H5HG.c
index b9d8dc3..63d482e 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -785,7 +785,13 @@ H5HG_remove (H5F_t *f, H5HG_t *hobj)
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap")
HDassert(hobj->idx < heap->nused);
- HDassert(heap->obj[hobj->idx].begin);
+
+ /* When the application selects the same location to rewrite the element by using H5Sselect_elements,
+ * it can happen that the entry has been removed by first rewrite. Here we simply skip the removal of
+ * the entry and let the second rewrite happen. */
+ if(heap->obj[hobj->idx].nrefs == 0 && heap->obj[hobj->idx].size == 0 && !heap->obj[hobj->idx].begin)
+ HGOTO_DONE(ret_value)
+
obj_start = heap->obj[hobj->idx].begin;
/* Include object header size */
need = H5HG_ALIGN(heap->obj[hobj->idx].size) + H5HG_SIZEOF_OBJHDR(f);