Re: [xml] xmlCleanupParser() question / patch

Daniel Veillard wrote:
On Thu, Jan 14, 2010 at 02:59:50AM +0100, Aron Szabo wrote:

If I use the library in a threaded program and call
xmlCleanupParser() I can't reinitialize it.

So here's what happens:

1. xmlCleanupThreads() is called from xmlCleanupParser()
2. the global key is deleted by xmlCleanupParser() which was created
by xmlOnceInit()

  That makes sense. there is a big problem anyway with
xmlCleanupParser() most people seems to think it need to be used after
parsing while it's a library global operation and really should not
be called after parsing but only when the library is not in use anymore.

So overall I'm tempted to change xmlCleanupParser() to become an empty
routine, and rename the real function as xmlCleanupLibrary().
That way the various shared libraries deployed with that bug won't need
to be changed specifically, avoiding crashes when multiple libraries
using libxml2 are used. Then your patch should be applied to the new
xmlCleanupLibrary() function.

  Opinions ?

Makes sense. Though all people that use it correctly will have to update their sources, which kind of seems unfair :-)

Best thing would be if xmlCleanupParser() would be removed completely, no?


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