diff options
author | Andreas Bille <abi@openoffice.org> | 2001-08-29 06:56:41 +0000 |
---|---|---|
committer | Andreas Bille <abi@openoffice.org> | 2001-08-29 06:56:41 +0000 |
commit | 6f82edcd28151cac28c5349e5fbaa610468385d5 (patch) | |
tree | 3a411d4e149d865b2262e14b7676ee1396e0d9c8 /ucb/source/ucp/file/filstr.cxx | |
parent | f2957672861fec425a31a1df99544dcd9edf7824 (diff) |
#91464#
Now closing only if both input- and outputstream have been closed.
Diffstat (limited to 'ucb/source/ucp/file/filstr.cxx')
-rw-r--r-- | ucb/source/ucp/file/filstr.cxx | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/ucb/source/ucp/file/filstr.cxx b/ucb/source/ucp/file/filstr.cxx index 6fd50bb2ba..a6ab0930d9 100644 --- a/ucb/source/ucp/file/filstr.cxx +++ b/ucb/source/ucp/file/filstr.cxx @@ -59,7 +59,9 @@ XStream_impl::XStream_impl( shell* pMyShell,const rtl::OUString& aUncPath ) m_aFile( aUncPath ), m_xProvider( m_pMyShell->m_pProvider ), m_nErrorCode( TASKHANDLER_NO_ERROR ), - m_nMinorErrorCode( TASKHANDLER_NO_ERROR ) + m_nMinorErrorCode( TASKHANDLER_NO_ERROR ), + m_bInputStreamCalled( false ), + m_bOutputStreamCalled( false ) { osl::FileBase::RC err = m_aFile.open( OpenFlag_Read | OpenFlag_Write ); if( err != osl::FileBase::E_None ) @@ -97,8 +99,12 @@ sal_Int32 SAL_CALL XStream_impl::getMinorError() uno::Reference< io::XInputStream > SAL_CALL XStream_impl::getInputStream( ) - throw( uno::RuntimeException) + throw( uno::RuntimeException) { + { + osl::MutexGuard aGuard( m_aMutex ); + m_bInputStreamCalled = true; + } return uno::Reference< io::XInputStream >( this ); } @@ -107,6 +113,10 @@ uno::Reference< io::XOutputStream > SAL_CALL XStream_impl::getOutputStream( ) throw( uno::RuntimeException ) { + { + osl::MutexGuard aGuard( m_aMutex ); + m_bOutputStreamCalled = true; + } return uno::Reference< io::XOutputStream >( this ); } @@ -227,7 +237,7 @@ XStream_impl::closeStream( { if( osl::FileBase::E_None != m_aFile.close() ) throw io::IOException(); - + m_nIsOpen = false; } } @@ -239,7 +249,11 @@ XStream_impl::closeInput( io::IOException, uno::RuntimeException ) { - // closeStream(); + osl::MutexGuard aGuard( m_aMutex ); + m_bInputStreamCalled = false; + + if( ! m_bOutputStreamCalled ) + closeStream(); } @@ -250,7 +264,11 @@ XStream_impl::closeOutput( io::IOException, uno::RuntimeException ) { - // closeStream(); + osl::MutexGuard aGuard( m_aMutex ); + m_bOutputStreamCalled = false; + + if( ! m_bInputStreamCalled ) + closeStream(); } |