Re: [xml] xmlReadFile(...) crashing on 2nd time around

Thank you Martin, that works.

However, I am intrigued to know why this causes an issue.

My program consists of:

   (1)  Main program is written in Borland C++ v5.01
   (2)  Regular MFC DLL

The program in (1) loads the DLL in (2) by calling LoadLibrary etc... the
DLL has Libxml2 statically linked.

The program (1) called loaded and unloaded the DLL in (2) which in turn
loaded an XML with Libxml2.  With the call into xmlCleanupParser() the 1st
call to the DLL was OK but if the program loaded the DLL again in the same
session a crash resulted.  Now that I have taken out the call into
xmlCleanupParser() I no longer get the crash.

I would appreciate if anyone can let me know why I no longer get the crash. 
Do I need to call anything other than xmlCleanupParser().  Of course I am
freeing the xmlDocPtr and contexts correctly.

Martin (gzlist) wrote:

On 10/12/2009, Andrew Hartley <andrew hartley bcs org uk> wrote:

This is my code to read an XML file, which works fine the 1st time
but crashes the 2nd time around.  I must be not calling a required
function to tidy up and would appreciate if someone could advise on what
should do.



Remove that from your destructor.


"This function name is somewhat misleading. It does not clean up
parser state, it cleans up memory allocated by the library itself"

xml mailing list, project page
xml gnome org

View this message in context:
Sent from the Gnome - Lib - Xml - General mailing list archive at

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