KoXmlWriter::addCompleteElement leaves device open
Thorsten Zachmann
t.zachmann at zagge.de
Sat Feb 5 04:21:31 GMT 2011
On Friday, February 04, 2011 23:17:57 David Faure wrote:
> I was surprised that the following code (which I'm working on for the
> applix filter) ...
>
> paragraphBuffer.close();
>
> bodyWriter->startElement("text:p");
> bodyWriter->addAttribute("text:style-name", autoStyleName);
> bodyWriter->addCompleteElement(¶graphBuffer);
> bodyWriter->endElement(); // text:p
>
> paragraphBuffer.setData(QByteArray());
>
> ... would fail in QBuffer::setData with "can't do that while the buffer is
> open".
>
> Turns out that addCompleteElement opens the iodevice, but doesn't close it
> afterwards -- blame me, I wrote that code long ago ;)
>
> Can I commit the attached patch?
> I had a look at the existing callers of addCompleteElement (some of them --
> there are many many more than I thought there would be!), and it seems to
> be always a one-time buffer. And if it was reused, then a second close()
> won't hurt.
Please commit.
Thorsten
More information about the calligra-devel
mailing list