summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorAndreas Bille <abi@openoffice.org>2001-08-29 06:56:41 +0000
committerAndreas Bille <abi@openoffice.org>2001-08-29 06:56:41 +0000
commit72eed07c9e226d068d6c3927a8ec66a96bfe724d (patch)
treec38b1ba0cec963617f198f892200edc289195d5b /ucb
parentc4d998a52e090d2ca97dfa6383144e737073202a (diff)
#91464#
Now closing only if both input- and outputstream have been closed.
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/file/filstr.cxx26
-rw-r--r--ucb/source/ucp/file/filstr.hxx6
2 files changed, 28 insertions, 4 deletions
diff --git a/ucb/source/ucp/file/filstr.cxx b/ucb/source/ucp/file/filstr.cxx
index 41f3fdb15e41..544caaba36c2 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 );
}
@@ -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();
}
diff --git a/ucb/source/ucp/file/filstr.hxx b/ucb/source/ucp/file/filstr.hxx
index 04466dbaf124..2704628e4d43 100644
--- a/ucb/source/ucp/file/filstr.hxx
+++ b/ucb/source/ucp/file/filstr.hxx
@@ -1,6 +1,9 @@
#ifndef _FILSTR_HXX_
#define _FILSTR_HXX_
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
#ifndef _RTL_USTRING_HXX_
#include <rtl/ustring.hxx>
#endif
@@ -195,6 +198,9 @@ namespace fileaccess {
private:
+ osl::Mutex m_aMutex;
+ bool m_bInputStreamCalled,m_bOutputStreamCalled;
+
shell* m_pMyShell;
com::sun::star::uno::Reference< com::sun::star::ucb::XContentProvider > m_xProvider;
sal_Bool m_nIsOpen;