
Thanks Johan and Krzysztof for your help with this.
On Wed, 2014-01-22 at 18:43 +0100, Johan Engelen wrote:
Could you make the list and parent pointer private to SPDoc? And then add the const method SPDoc::find...() that returns NULL if nothing was found.
To do the infinite-loop prevention I had to move child->parent_document line into SPDocument::createDoc anyway. So those two lines happen when one specifies a parent when creating a document.
I've also moved the bulk of the code to document.cpp under a new createChildDoc function which we can use from image.cpp to load those new viewports I'm fancying. But also to make the two new variables private.
I decided to change xml/repr-io's warning about missing files, which I hit when I use'd a file that didn't exist; so from:** (inkscape:30541):
CRITICAL **: Inkscape::XML::Document* sp_repr_read_file(const gchar*, const gchar*): assertion `Inkscape::IO::file_test( filename, G_FILE_TEST_EXISTS )' failed CRITICAL **: void Inkscape::URIReference::attach(const Inkscape::URI&): assertion `document != NULL' failed
to:
WARNING **: Can't open file: /tmp/use/dead.svg (doesn't exist) WARNING **: Can't get document for referenced URI: dead.svg#grave
Which is much cleaner but I hope no one minds the change since it'll effect normal opens too. Now we have protection against infinite loops, dead links and specifying ones own document's filename.
Martin,