title: librsvg crash due to libxml2?
body: <p>I'm looking to support rendering SVG images as Bitmaps, I'm using librsvg.  So far it works well and draws using Cairo, hooray!  However I've run into an issue:</p>
  
  <p>We have a control that is similar to Windows Explorer, e.g. it creates thumbnail-sized images of files in a directory, so the product would be extended to generate thumbnails of SVG's.</p>
  
  <p>It uses background threads to generate the thumbnail images so the UI isn't frozen as it's working.  The code has been in production for a long time so no problem as far as concurrency issues go.  But it seems when rsvg_handle_new() is called from a thread other than the main thread an Access Violation occurs, when it's not I have no issue working with librsvg.</p>
  
  <p>Looking at the stack trace the crash appears to be occurring in libxml2 (which is a dependency of librsvg) at xmlSetGlobalState(), the problem seems the same as reported here <a href="https://stackoverflow.com/questions/3127472/libxml2-crash-on-second-use-on-windows">libxml2 crash on second use on Windows</a>  which doesn't seem to have a resolution.  I would limit my use of the library to the main thread only if I could, but I'm stuck with this existing architecture which produces the thumbnails off the main thread.</p>
  
  <p>I found <a href="http://www.xmlsoft.org/threads.html" rel="nofollow noreferrer">http://www.xmlsoft.org/threads.html</a> which suggests calling xmlInitParser() in the main thread first which seems to be called by librsvg during the RsvgHandle creation (I think).</p>
  
  <p>So I'm not sure if it's really a libxml2 problem, a problem with the way librsvg is using libxml2, or a problem with the way I'm trying to use librsvg?</p>
  
  <p>Any libxml2 or librsvg experts?</p>