summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-07-13 16:17:00 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-08-03 06:37:16 +0000
commit2660d24a07866e083c5135ea263030f3e3a2e729 (patch)
tree0089d6018d4fc33a7fde955e585e77191cdd258b /writerfilter
parentbaba1d14766282bd2c592bffd79ed69f9078cfe1 (diff)
new loplugin: refcounting
This was a feature requested by mmeeks, as a result of tdf#92611. It validates that things that extend XInterface are not directly heap/stack-allocated, but have their lifecycle managed via css::uno::Reference or rtl::Reference. Change-Id: I28e3b8b236f6a4a56d0a6d6f26ad54e44b36e692 Reviewed-on: https://gerrit.libreoffice.org/16924 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/filter/WriterFilter.cxx4
-rw-r--r--writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx19
-rw-r--r--writerfilter/source/ooxml/OOXMLFastDocumentHandler.hxx4
3 files changed, 13 insertions, 14 deletions
diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx
index 4568cb947145..5ce5e642c0ff 100644
--- a/writerfilter/source/filter/WriterFilter.cxx
+++ b/writerfilter/source/filter/WriterFilter.cxx
@@ -159,8 +159,8 @@ sal_Bool WriterFilter::filter(const uno::Sequence< beans::PropertyValue >& aDesc
try
{
// use the oox.core.FilterDetect implementation to extract the decrypted ZIP package
- ::oox::core::FilterDetect aDetector(m_xContext);
- xInputStream = aDetector.extractUnencryptedPackage(aMediaDesc);
+ uno::Reference<::oox::core::FilterDetect> xDetector(new ::oox::core::FilterDetect(m_xContext));
+ xInputStream = xDetector->extractUnencryptedPackage(aMediaDesc);
}
catch (uno::Exception&)
{
diff --git a/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx b/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx
index 76c81f01d885..2d7ba7a2f39c 100644
--- a/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx
@@ -42,7 +42,7 @@ OOXMLFastDocumentHandler::OOXMLFastDocumentHandler(
#endif
, mpDocument( pDocument )
, mnXNoteId( nXNoteId )
- , mpContextHandler()
+ , mxContextHandler()
{
}
@@ -119,20 +119,19 @@ throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
#endif
}
-OOXMLFastContextHandler::Pointer_t
+uno::Reference< OOXMLFastContextHandler >
OOXMLFastDocumentHandler::getContextHandler() const
{
- if (mpContextHandler == OOXMLFastContextHandler::Pointer_t())
+ if (!mxContextHandler.is())
{
- mpContextHandler.reset
- (new OOXMLFastContextHandler(m_xContext));
- mpContextHandler->setStream(mpStream);
- mpContextHandler->setDocument(mpDocument);
- mpContextHandler->setXNoteId(mnXNoteId);
- mpContextHandler->setForwardEvents(true);
+ mxContextHandler = new OOXMLFastContextHandler(m_xContext);
+ mxContextHandler->setStream(mpStream);
+ mxContextHandler->setDocument(mpDocument);
+ mxContextHandler->setXNoteId(mnXNoteId);
+ mxContextHandler->setForwardEvents(true);
}
- return mpContextHandler;
+ return mxContextHandler;
}
uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
diff --git a/writerfilter/source/ooxml/OOXMLFastDocumentHandler.hxx b/writerfilter/source/ooxml/OOXMLFastDocumentHandler.hxx
index 8678c07c9909..8a49e5d7fa93 100644
--- a/writerfilter/source/ooxml/OOXMLFastDocumentHandler.hxx
+++ b/writerfilter/source/ooxml/OOXMLFastDocumentHandler.hxx
@@ -97,8 +97,8 @@ private:
#endif
OOXMLDocumentImpl* mpDocument;
sal_Int32 mnXNoteId;
- mutable std::shared_ptr<OOXMLFastContextHandler> mpContextHandler;
- std::shared_ptr<OOXMLFastContextHandler> getContextHandler() const;
+ mutable css::uno::Reference<OOXMLFastContextHandler> mxContextHandler;
+ css::uno::Reference<OOXMLFastContextHandler> getContextHandler() const;
};
}}