Hi All,
I'm just continuing to work on the native win32 file dialogs. Things are coming along, slowly, but I've stumbled into yet another problem. In order to render a preview of the selected file I need to be able to rasterise an SVG file. Because of the way the windows file dialog works, it has to be executed from a worker thread - not from the main UI thread, otherwise the rest of inkscape locks up in the background.
To show an SVG preview, I need to be able to rasterise a file in this worker thread. I've prepared the beginnings of a routine to do this, derived from the sp_export_png_file file in png-write.cpp. My problem is that when I call sp_document_new_from_mem in the worker thread, the application crashes, when it comes to the line
Document *rdoc = new Inkscape::XML::SimpleDocument();
in sp_repr_do_read in repr-io.cpp. It seems to work properly when called from the main UI thread though. It would seem like some kind of thread-safety issue, but does anyone have a clearer idea what might be going wrong here? and any suggestions?
If not, then I'll continue to persevere; I just thought I'd ask because it's so hard for me to bring in a debugger, the way my environment's set up.
Thanks Joel