Review Request: Bug in KoXml* to QDom* conversion

Dag Andersen danders at get2net.dk
Wed Jan 11 14:21:53 GMT 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/103674/
-----------------------------------------------------------

(Updated Jan. 11, 2012, 2:21 p.m.)


Review request for Calligra.


Changes
-------

Also append text nodes to document


Description
-------

Symptom:
Plan (sometimes) crashes and valgrind reports "Invalid read size".

When KoXml* is converted to QDom* a temporary QDomDocument is used to create nodes.
This results in deleted nodes when the document goes out of scope.
>From QDomDocument api docs:
"Since elements, text nodes, comments, processing instructions, etc., cannot exist outside the context of a document, the document class also contains the factory functions needed to create these objects. The node objects created have an ownerDocument() function which associates them with the document within whose context they were created."

In short the patch passes ownerDoc as a reference and appends the converted nodes to the ownerDoc.
Also asQDomNode()/asQDomElement() does not return anything, the node must be found in ownerDoc.

Modifications to the users is not included.

Note that the patch is not quite finished because I don't understand the TestXmlReaderWithoutSpaces unit test.


Diffs (updated)
-----

  libs/odf/KoXmlReader.h 231651c 
  libs/odf/KoXmlReader.cpp 13a6d47 
  libs/odf/tests/TestXmlReader.cpp 6631b64 
  libs/odf/tests/TestXmlReaderWithoutSpaces.cpp 5179846 

Diff: http://git.reviewboard.kde.org/r/103674/diff/diff


Testing
-------

Unit test passes (but it did before too).
No crash in Plan.


Thanks,

Dag Andersen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/calligra-devel/attachments/20120111/e4bcd4bf/attachment.htm>


More information about the calligra-devel mailing list