summaryrefslogtreecommitdiff
path: root/package/source/xstor/owriteablestream.cxx
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-03-12 18:20:10 +0100
committerMichael Stahl <mstahl@redhat.com>2015-03-12 20:22:12 +0100
commit9ad17c2536468b37c04bc7f7b74dd794d1dc38c7 (patch)
treec16956971f30dbc6494cfba8030c937dee7bea2b /package/source/xstor/owriteablestream.cxx
parent2877e5a9c7507acc9282e70323259b5c043dda0c (diff)
package: convert OWriteStream::m_pData to std::unique_ptr
Change-Id: I9e72325679b2758cd4297d2693cf49fd533f8baa
Diffstat (limited to 'package/source/xstor/owriteablestream.cxx')
-rw-r--r--package/source/xstor/owriteablestream.cxx26
1 files changed, 11 insertions, 15 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()