Re: [xml] calling xmlCleanupParser from a library considered harmful



On 05/11/12 14:03, Alex Bligh wrote:

On 5 Nov 2012, at 12:48, Michael Stahl wrote:

yes, that would probably be an improvement (or the ~equivalent of
replacing xmlCleanupParser with NOP and adding new xmlReallyCleanupStuff
suggested in the other mail).

Well, the *real* fix would be to give everyone an 'XmlContext' (preferably
provided as a totally opaque void *). These could maintained by libxml on
a list. At some future points, stuff requiring static storage might take
this as a parameter. Right now the XmlContext need not contain anything.
This will prevent an xmlFreeContext being called by the same user twice
from deiniting the library, as it can check the context is on the list
first.

yes that kind of thing would be the real fix, but the effort involved is
significant and it would quite likely require breaking ABI.

also this is not my first "considered harmful" rant on this topic :)
https://mail.gnome.org/archives/xml/2010-July/msg00004.html

or as my colleague Stephan Bergmann told me some minutes ago:

"best would be to simply live with false valgrind leak warnings?  once a
library has a broken design (uses global state) there is no way to get
that working short of fixing the design;  otherwise, people would run
into the "no libxml2 usage from atexit handlers" problem etc."




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]