From 594c12d52d4da2bbf9f1f94071df364e586b6de7 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 4 Dec 2024 17:06:22 -0600 Subject: [PATCH] Add missed protection around user callback Signed-off-by: Quincey Koziol --- src/H5Iint.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/H5Iint.c b/src/H5Iint.c index aeb8ed25935..5be8dcd38a8 100644 --- a/src/H5Iint.c +++ b/src/H5Iint.c @@ -1495,7 +1495,12 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) object = H5I__unwrap(info->u.object, type); /* Invoke callback function */ - cb_ret_val = (*udata->user_func)((void *)object, info->id, udata->user_udata); + /* Prepare & restore library for user callback */ + H5_BEFORE_USER_CB_NOERR(H5_ITER_ERROR) + { + cb_ret_val = (*udata->user_func)((void *)object, info->id, udata->user_udata); + } + H5_AFTER_USER_CB_NOERR(NULL) /* Set the return value based on the callback's return value */ if (cb_ret_val > 0)