summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-04-16 14:35:55 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-04-16 15:32:26 +0200
commitcc5811402aed36d05ceaa9b65ef31886fb163d0a (patch)
tree53bd1673fc66e023765cb1c913339a35baedcd9a /writerfilter
parent2a3e8b470edf2fe76188f9ccf6b0f32dfc817ea4 (diff)
rtftok: handle over ownership of stream to utl::OSeekableInputStreamWrapper
Previously we just kept the stream around till the next embedded object or document end and hoped that the stream wrapper is deleted before the underlying stream goes away. Change-Id: If2bdb1e664d803fc48d06204fe3aef72b279b5b6
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx9
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx2
2 files changed, 5 insertions, 6 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index d00662375dfc..8550613ad6db 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -6042,6 +6042,8 @@ RTFError RTFDocumentImpl::handleEmbeddedObject()
}
}
+ std::unique_ptr<SvStream> pStream(new SvMemoryStream());
+
// Skip ObjectHeader, see [MS-OLEDS] 2.2.4.
if (aStream.Tell())
{
@@ -6059,13 +6061,12 @@ RTFError RTFDocumentImpl::handleEmbeddedObject()
if (nData)
{
- m_pObjectData.reset(new SvMemoryStream());
- m_pObjectData->WriteStream(aStream);
- m_pObjectData->Seek(0);
+ pStream->WriteStream(aStream);
+ pStream->Seek(0);
}
}
- uno::Reference<io::XInputStream> xInputStream(new utl::OSeekableInputStreamWrapper(m_pObjectData.get()));
+ uno::Reference<io::XInputStream> xInputStream(new utl::OSeekableInputStreamWrapper(pStream.release(), /*_bOwner=*/true));
auto pStreamValue = std::make_shared<RTFValue>(xInputStream);
m_aOLEAttributes.set(NS_ooxml::LN_inputstream, pStreamValue);
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 0af39d3ae98a..dddd0eeb6509 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -548,8 +548,6 @@ private:
* \objdata element.
* (if we don't use the \objdata we use the \result element)*/
bool m_bObject;
- /// Contents of the objdata group.
- std::shared_ptr<SvStream> m_pObjectData;
/// If the data for a picture is a binary one, it's stored here.
std::shared_ptr<SvStream> m_pBinaryData;