On Thu, 18 Dec 2025 19:37:45 +0100 Martin Husemann <[email protected]> wrote:
> On Thu, Dec 18, 2025 at 07:27:51PM +0100, Henryk Paluch wrote: > > I'm sorry but it is not bug in Mesa - thanks to RVP now we know for sure > > that it is bug in handling atexit(3) call when invoked from shared libraries > > via dlopen(3)/dlclose(3) calls. As demonstrated by RVP's example. > > You can not portably use atexit() for a function from a shared library > that you then dlclose() before exiting. > > Use a destructor function instead. > > Martin I would say do not use atexit() at all unless you have a very primitive program which does not rely on: shared libs, signals, longjmp, abort(), etc. There are too many cases where functions registered with atexit() will not be called. A shared library calling atexit() is just as bad when it calls exit(). It is most likely to be a bad library design.
