From bc09385ce297219f1976a9ca41a0b30902b9326d Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 11 Nov 2016 11:23:17 +0000 Subject: the pStream member makes no sense at all MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit maybe the PurgeMedia call in sw was meant to be a PurgeGraphic call originally (PurgeGraphic since removed by... commit a22ac2c218870033822120bf0b0d6cfde6ce799f Author: Caolán McNamara Date: Thu Jul 14 22:06:29 2011 +0100 callcatcher: remove unused methods) PurgeMedia releasing the stream makes no difference to the only place its used which is SvxBrushItem::GetGraphicObject which makes a new one every time anyway. the SvxBrushItem assignment operator doesn't change the stream member of the pImpl which looks utterly nuts, so its a good thing the stream is not reused Change-Id: Ie0dee22a6640a6916908fcddbc3541ba85034217 --- editeng/source/items/frmitems.cxx | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'editeng') diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index a6618ea363ce..c71b754e32ac 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -3267,8 +3267,6 @@ public: std::unique_ptr xGraphicObject; sal_Int8 nGraphicTransparency; //contains a percentage value which is //copied to the GraphicObject when necessary - std::unique_ptr xStream; - explicit SvxBrushItem_Impl(GraphicObject* p) : xGraphicObject(p) , nGraphicTransparency(0) @@ -3838,11 +3836,6 @@ SvStream& SvxBrushItem::Store( SvStream& rStream , sal_uInt16 /*nItemVersion*/ ) return rStream; } -void SvxBrushItem::PurgeMedium() const -{ - pImpl->xStream.reset(); -} - const GraphicObject* SvxBrushItem::GetGraphicObject(OUString const & referer) const { if (bLoadAgain && !maStrLink.isEmpty() && !pImpl->xGraphicObject) @@ -3857,12 +3850,11 @@ const GraphicObject* SvxBrushItem::GetGraphicObject(OUString const & referer) co bool bGraphicLoaded = false; // try to create stream directly from given URL - pImpl->xStream.reset(utl::UcbStreamHelper::CreateStream(maStrLink, StreamMode::STD_READ)); - + std::unique_ptr xStream(utl::UcbStreamHelper::CreateStream(maStrLink, StreamMode::STD_READ)); // tdf#94088 if we have a stream, try to load it directly as graphic - if (pImpl->xStream && !pImpl->xStream->GetError()) + if (xStream && !xStream->GetError()) { - if (GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, maStrLink, *pImpl->xStream, + if (GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, maStrLink, *xStream, GRFILTER_FORMAT_DONTKNOW, nullptr, GraphicFilterImportFlags::DontSetLogsizeForJpeg)) { bGraphicLoaded = true; @@ -3877,10 +3869,10 @@ const GraphicObject* SvxBrushItem::GetGraphicObject(OUString const & referer) co if( INetProtocol::Data == aGraphicURL.GetProtocol() ) { - std::unique_ptr const xStream(aGraphicURL.getData()); - if (xStream) + std::unique_ptr const xMemStream(aGraphicURL.getData()); + if (xMemStream) { - if (GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, "", *xStream)) + if (GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, "", *xMemStream)) { bGraphicLoaded = true; -- cgit