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:
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.
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.
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 libxml2 crash on second use on Windows 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.
I found http://www.xmlsoft.org/threads.html which suggests calling xmlInitParser() in the main thread first which seems to be called by librsvg during the RsvgHandle creation (I think).
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?
Any libxml2 or librsvg experts?