diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-03-12 18:20:10 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-03-12 20:22:12 +0100 |
commit | 9ad17c2536468b37c04bc7f7b74dd794d1dc38c7 (patch) | |
tree | c16956971f30dbc6494cfba8030c937dee7bea2b /package/source | |
parent | 2877e5a9c7507acc9282e70323259b5c043dda0c (diff) |
package: convert OWriteStream::m_pData to std::unique_ptr
Change-Id: I9e72325679b2758cd4297d2693cf49fd533f8baa
Diffstat (limited to 'package/source')
-rw-r--r-- | package/source/xstor/owriteablestream.cxx | 26 | ||||
-rw-r--r-- | package/source/xstor/owriteablestream.hxx | 2 |
2 files changed, 12 insertions, 16 deletions
diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index cf20db3e4d38..38e6563e8ff3 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -1683,7 +1683,7 @@ OWriteStream::OWriteStream( OWriteStream_Impl* pImpl, bool bTransacted ) if ( !m_pImpl || !m_pImpl->m_rMutexRef.Is() ) throw uno::RuntimeException(); // just a disaster - m_pData = new WSInternalData_Impl( pImpl->m_rMutexRef, m_pImpl->m_nStorageType ); + m_pData.reset(new WSInternalData_Impl(pImpl->m_rMutexRef, m_pImpl->m_nStorageType)); } OWriteStream::OWriteStream( OWriteStream_Impl* pImpl, uno::Reference< io::XStream > xStream, bool bTransacted ) @@ -1699,7 +1699,7 @@ OWriteStream::OWriteStream( OWriteStream_Impl* pImpl, uno::Reference< io::XStrea if ( !m_pImpl || !m_pImpl->m_rMutexRef.Is() ) throw uno::RuntimeException(); // just a disaster - m_pData = new WSInternalData_Impl( pImpl->m_rMutexRef, m_pImpl->m_nStorageType ); + m_pData.reset(new WSInternalData_Impl(pImpl->m_rMutexRef, m_pImpl->m_nStorageType)); if ( xStream.is() ) { @@ -1712,23 +1712,19 @@ OWriteStream::OWriteStream( OWriteStream_Impl* pImpl, uno::Reference< io::XStrea OWriteStream::~OWriteStream() { + ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + if ( m_pImpl ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); - if ( m_pImpl ) + m_refCount++; + try { + dispose(); + } + catch( const uno::RuntimeException& rRuntimeException ) { - m_refCount++; - try { - dispose(); - } - catch( const uno::RuntimeException& rRuntimeException ) - { - m_pImpl->AddLog( rRuntimeException.Message ); - m_pImpl->AddLog( "Quiet exception" ); - } + m_pImpl->AddLog( rRuntimeException.Message ); + m_pImpl->AddLog( "Quiet exception" ); } } - - delete m_pData; } void OWriteStream::DeInit() diff --git a/package/source/xstor/owriteablestream.hxx b/package/source/xstor/owriteablestream.hxx index 066d8808262d..ad6ddf27e54b 100644 --- a/package/source/xstor/owriteablestream.hxx +++ b/package/source/xstor/owriteablestream.hxx @@ -276,7 +276,7 @@ protected: ::com::sun::star::uno::Reference < ::com::sun::star::io::XSeekable > m_xSeekable; OWriteStream_Impl* m_pImpl; - WSInternalData_Impl* m_pData; + std::unique_ptr<WSInternalData_Impl> m_pData; bool m_bInStreamDisconnected; bool m_bInitOnDemand; |