Hello, I had this problem, too.
It was fixed upstream in the next version, 2.7. See http://bugzilla.gnome.org/show_bug.cgi?id=150082 It is an easy 2-file patch, and it fixed the problem for me. You can have a look at the changes here: http://cvs.gnome.org/viewcvs/libxml%2B%2B/libxml%2B% 2B/parsers/domparser.cc?r1=1.2&r2=1.3 http://cvs.gnome.org/viewcvs/libxml%2B%2B/libxml%2B% 2B/parsers/parser.cc?r1=1.3&r2=1.4 Two patches are attached. I hope they are in the right format. Best regards, Zeno --
=================================================================== RCS file: /cvs/gnome/libxml++/libxml++/parsers/parser.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- parser.cc 2004/02/06 17:37:53 1.3 +++ parser.cc 2004/08/13 21:02:36 1.4 @@ -76,6 +76,11 @@ { context_->_private = 0; //Not really necessary. + if( context_->myDoc != NULL ) + { + xmlFreeDoc(context_->myDoc); + } + xmlFreeParserCtxt(context_); context_ = 0; }
=================================================================== RCS file: /cvs/gnome/libxml++/libxml++/parsers/domparser.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- domparser.cc 2003/12/19 18:52:15 1.2 +++ domparser.cc 2004/08/13 21:02:36 1.3 @@ -105,6 +105,9 @@ } doc_ = new Document(context_->myDoc); + // This is to indicate to release_underlying that we took the + // ownership on the doc. + context_->myDoc = NULL; //Free the parse context, but keep the document alive so people can navigate the DOM tree: //TODO: Why not keep the context alive too? @@ -164,6 +167,10 @@ } doc_ = new Document(context_->myDoc); + // This is to indicate to release_underlying that we took the + // ownership on the doc. + context_->myDoc = NULL; + //Free the parse context, but keep the document alive so people can navigate the DOM tree: //TODO: Why not keep the context alive too?