I finally found a fix for the crash I was experiencing. I went back and read
the documentation for libxml2 and found this (
http://xmlsoft.org/threads.html)

"call xmlInitParser() in the "main" thread before using any of the libxml2
> API (except possibly selecting a different memory allocator)"
>


After making the following change to xml.cpp, everything works fine.

    if(_reader)
      return true; //do not need to make a new reader

    //fix crash on GC in the C# bindings
    xmlInitParser();

    //If the inputstream is not at the start (probably arising in
fastsearch),
    //save its position and rewind so that the reader initialization is ok.
    //(Getting the requested object is handled in ReadXML(), when the format
is known.)
    _requestedpos = GetInStream()->tellg();

The root cause of the crash was that the CLI runs finalizers in a separate
thread, but libxml wasn't being setup for a multithreaded environment. While
I don't think that adding this call will impact the base code, I wanted to
run it by more experienced C++ programmers before committing anything.

-Matt
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
OpenBabel-scripting mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbabel-scripting

Reply via email to