diff options
author | Noel Grandin <noel@peralex.com> | 2015-07-13 16:17:00 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-08-03 06:37:16 +0000 |
commit | 2660d24a07866e083c5135ea263030f3e3a2e729 (patch) | |
tree | 0089d6018d4fc33a7fde955e585e77191cdd258b /ucb | |
parent | baba1d14766282bd2c592bffd79ed69f9078cfe1 (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 'ucb')
-rw-r--r-- | ucb/source/ucp/cmis/cmis_content.cxx | 4 | ||||
-rw-r--r-- | ucb/source/ucp/tdoc/tdoc_storage.cxx | 3 |
2 files changed, 3 insertions, 4 deletions
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx index bc77db188351..3ee3518dd599 100644 --- a/ucb/source/ucp/cmis/cmis_content.cxx +++ b/ucb/source/ucp/cmis/cmis_content.cxx @@ -521,8 +521,8 @@ namespace cmis aParentUrl.removeSegment( ); OUString sParentUrl = aParentUrl.GetMainURL( INetURLObject::NO_DECODE ); - Content aParent( m_xContext, m_pProvider, new ucbhelper::ContentIdentifier( sParentUrl ) ); - libcmis::FolderPtr pParentFolder = boost::dynamic_pointer_cast< libcmis::Folder >( aParent.getObject( xEnv ) ); + uno::Reference<Content> xParent( new Content(m_xContext, m_pProvider, new ucbhelper::ContentIdentifier( sParentUrl )) ); + libcmis::FolderPtr pParentFolder = boost::dynamic_pointer_cast< libcmis::Folder >( xParent->getObject( xEnv ) ); if ( pParentFolder ) { vector< libcmis::ObjectPtr > children = pParentFolder->getChildren( ); diff --git a/ucb/source/ucp/tdoc/tdoc_storage.cxx b/ucb/source/ucp/tdoc/tdoc_storage.cxx index 31168a08d504..ea5f1e8acfc5 100644 --- a/ucb/source/ucp/tdoc/tdoc_storage.cxx +++ b/ucb/source/ucp/tdoc/tdoc_storage.cxx @@ -181,7 +181,7 @@ StorageElementFactory::createStorage( const OUString & rUri, bool bWritable = ( ( eMode == READ_WRITE_NOCREATE ) || ( eMode == READ_WRITE_CREATE ) ); - std::unique_ptr< Storage > xElement( + uno::Reference< Storage > xElement( new Storage( m_xContext, this, aUriKey, xParentStorage, xStorage ) ); aIt = m_aMap.insert( @@ -190,7 +190,6 @@ StorageElementFactory::createStorage( const OUString & rUri, xElement.get() ) ).first; aIt->second->m_aContainerIt = aIt; - xElement.release(); return aIt->second; } else if ( osl_atomic_increment( &aIt->second->m_refCount ) > 1 ) |