2017.05.21 19:28 "[Tiff] Libtiff 4.0.8 released", by Bob Friesenhahn

2017.07.05 13:57 "Re: [Tiff] A bug in libtiff error/warning handling", by Paavo Helde

On 5.07.2017 15:40, Olivier Paquet wrote:

By the way, thread local storage is a poor solution as it does not handle the case of several unrelated libraries using libtiff from within the same thread.

This can be made to work if the client library installs and restores the handlers each time before/after any call to libTIFF. Yes that's tedious but better than the current state. Better fixes would mean API changes, like adding error/warning pointers to an enhanced version of TIFFClientOpen().

Another hypothetical option would be to gather errors and warnings in thread local storage inside libTIFF and provide special API calls for retrieving these messages for the last libTIFF call in the current thread. This means that there would be no need to install any error/warning handlers; the client libraries which are not interested in the messages would just not call these routines. The messages would be automatically cleared in the start of the next libTIFF API call (in the same thread).

This is basically the same what I do in our app when calling libtiff. I gather the messages in the handlers (held in thread-local storage BTW because I cannot trust the tif_clientdata pointer) and if the libtiff call fails I will attach the gathered libtiff messages to my error message.

Paavo