On 17 September 2017 at 17:46, Yuri <y...@rawbw.com> wrote: >> Maybe the right solution is to add explicit pixman_init() and >> pixman_destroy() functions. But we need to support existing >> applications too and we can't expect them to start using these >> new functions without enforcing some changes. That's a kind of >> historical baggage, and nobody feels like opening this can of >> worms. > > > > You can't rely on the apps to always call the right functions. Instead, the > correct behavior is to uninitialize on exit. What you need to do is to > schedule uninitialization with atexit call. > (https://linux.die.net/man/3/atexit) > > The behavior should be the same as when there is a static C++ object with > destructor. Such destructor will always be called via atexit, either at the > end of the application, or when the shared library is unloaded. > Having the opposite - a destructor [1] should provide symmetry and consistency. Furthermore using atexit is not as portable/reliable as one would think.
All this is obviously orthogonal to the original issue reported ;-) -Emil [1] https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-destructor-function-attribute [2] https://bugs.freedesktop.org/show_bug.cgi?id=91869 _______________________________________________ Pixman mailing list Pixman@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/pixman