Fix segfault in H5T__unlock_cb for partially initialized datatypes
Will add some more fixes to this PR after testing, based on feedback in https://github.com/h5py/h5py/issues/2419
Before the type conversion optimization changes in the 1.14.4 release, the previous behavior of the library's compound datatype conversion function was to always register IDs for the members of the source and destination compound datatypes once during conversion path initialization and cache those IDs. After those changes, the registration of IDs was deferred until after the conversion path for each of the source compound members being converted was determined. That way, the library could determine if it needs to register IDs based on whether any of the conversion functions used is an application conversion function or whether a conversion exception function was provided.
However, this created a leak of these IDs when the compound conversion function recalculates cached data after the library's table of conversion functions is modified. Since this resulted in multiple IDs pointing to the same H5T_t structure, an application could encounter crashes, assertion failures or use-after-free issues, depending on the build type and whether or not free lists are enabled.