do not close input, unless it was us who opened it

Change-Id: I6ffedd1e64e48b4fc4bd6f5eb63e96b49f1a8508
This commit is contained in:
David Tardon 2014-01-16 16:15:10 +01:00
parent 7d432a9e67
commit 28619201e9
2 changed files with 4 additions and 1 deletions

View File

@ -51,6 +51,7 @@ class OZipFileAccess : public ::cppu::WeakImplHelper4<
::cppu::OInterfaceContainerHelper* m_pListenersContainer; ::cppu::OInterfaceContainerHelper* m_pListenersContainer;
sal_Bool m_bDisposed; sal_Bool m_bDisposed;
bool m_bOwnContent;
public: public:
OZipFileAccess( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); OZipFileAccess( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );

View File

@ -43,6 +43,7 @@ OZipFileAccess::OZipFileAccess( const uno::Reference< uno::XComponentContext >&
, m_pZipFile( NULL ) , m_pZipFile( NULL )
, m_pListenersContainer( NULL ) , m_pListenersContainer( NULL )
, m_bDisposed( sal_False ) , m_bDisposed( sal_False )
, m_bOwnContent( false )
{ {
if ( !rxContext.is() ) if ( !rxContext.is() )
throw uno::RuntimeException(OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() ); throw uno::RuntimeException(OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
@ -188,6 +189,7 @@ void SAL_CALL OZipFileAccess::initialize( const uno::Sequence< uno::Any >& aArgu
if ( aContent.openStream ( xSink ) ) if ( aContent.openStream ( xSink ) )
{ {
m_xContentStream = xSink->getInputStream(); m_xContentStream = xSink->getInputStream();
m_bOwnContent = true;
xSeekable = uno::Reference< io::XSeekable >( m_xContentStream, uno::UNO_QUERY ); xSeekable = uno::Reference< io::XSeekable >( m_xContentStream, uno::UNO_QUERY );
} }
} }
@ -385,7 +387,7 @@ void SAL_CALL OZipFileAccess::dispose()
m_pZipFile = NULL; m_pZipFile = NULL;
} }
if ( m_xContentStream.is() ) if ( m_xContentStream.is() && m_bOwnContent )
try { try {
m_xContentStream->closeInput(); m_xContentStream->closeInput();
} catch( uno::Exception& ) } catch( uno::Exception& )