[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdenonbeta/kdom/xpath/impl
From:       Frerich Raabe <raabe () kde ! org>
Date:       2005-08-16 1:44:29
Message-ID: 1124156669.347865.25513.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 449587 by raabe:

- Avoid that Parser::syncParse calls delete on an stack-based object. ;-/


 M  +6 -4      interpreter_tester.cpp  


--- trunk/kdenonbeta/kdom/xpath/impl/interpreter_tester.cpp #449586:449587
@@ -115,14 +115,16 @@
 
 	KApplication app( argc, argv, "foo" );
 
-	QBuffer buf;
-	buf.open( IO_ReadWrite );
-	buf.writeBlock( bookMarkup.utf8().data(), bookMarkup.utf8().size() );
+	// Parser::syncParse called blow deletes the given buffer, so we
+	// cannot use QBuffer objects which live on the stack.
+	QBuffer *buf = new QBuffer;
+	buf->open( IO_ReadWrite );
+	buf->writeBlock( bookMarkup.utf8().data(), bookMarkup.utf8().size() );
 
 	// I can't believe that I have to go through all these hoops to get
 	// a DocumentImpl* out of a string with markup.
 	Parser *parser = ParserFactory::self()->request( KURL(), 0, "qxml" );
-	DocumentImpl *doc = parser->syncParse( &buf );
+	DocumentImpl *doc = parser->syncParse( buf );
 
 	check( doc, "/book", QStringList() << "1" );
 	check( doc, "/book/chapter", QStringList() << "3" << "6" << "8" );
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic