Kaydet (Commit) 0799130b authored tarafından Michael Stahl's avatar Michael Stahl

fdo#59022: revert "SfxMedium::GetOutputStream(): re-use existing XStream"

Revert commit 0c220608, since this
apparently causes failure to open ODF files via SMB on Linux.

Instead of changing SfxMedium, adjust the ScExportTest: when saving
XLSX files interactively, the SfxFilter::lFormat is always 0, which
causes SfxObjectShell::SaveTo_Impl not to call
SfxMedium::GetOutputStorage() at all, working around the locking issue
on WNT.

Change-Id: I0ab8b4262475e4c8425eebb1413997457e5e9417
üst f6f5bde0
......@@ -127,7 +127,7 @@ ScDocShellRef ScExportTest::saveAndReloadPassword(ScDocShell* pShell, const rtl:
aTempFile.EnableKillingFile();
SfxMedium aStoreMedium( aTempFile.GetURL(), STREAM_STD_WRITE );
sal_uInt32 nExportFormat = 0;
if (nFormatType)
if (nFormatType == ODS_FORMAT_TYPE)
nExportFormat = SFX_FILTER_EXPORT | SFX_FILTER_USESOPTIONS;
SfxFilter* pExportFilter = new SfxFilter(
rFilter,
......@@ -150,7 +150,7 @@ ScDocShellRef ScExportTest::saveAndReloadPassword(ScDocShell* pShell, const rtl:
//std::cout << "File: " << aTempFile.GetURL() << std::endl;
sal_uInt32 nFormat = 0;
if (nFormatType)
if (nFormatType == ODS_FORMAT_TYPE)
nFormat = SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS;
OUString aPass("test");
......@@ -165,7 +165,7 @@ ScDocShellRef ScExportTest::saveAndReload(ScDocShell* pShell, const rtl::OUStrin
aTempFile.EnableKillingFile();
SfxMedium aStoreMedium( aTempFile.GetURL(), STREAM_STD_WRITE );
sal_uInt32 nExportFormat = 0;
if (nFormatType)
if (nFormatType == ODS_FORMAT_TYPE)
nExportFormat = SFX_FILTER_EXPORT | SFX_FILTER_USESOPTIONS;
SfxFilter* pExportFilter = new SfxFilter(
rFilter,
......@@ -179,7 +179,7 @@ ScDocShellRef ScExportTest::saveAndReload(ScDocShell* pShell, const rtl::OUStrin
//std::cout << "File: " << aTempFile.GetURL() << std::endl;
sal_uInt32 nFormat = 0;
if (nFormatType)
if (nFormatType == ODS_FORMAT_TYPE)
nFormat = SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS;
return load(aTempFile.GetURL(), rFilter, rUserData, rTypeName, nFormat, nFormatType);
......
......@@ -636,20 +636,13 @@ SvStream* SfxMedium::GetOutStream()
if ( pImp->pTempFile )
{
// try to re-use XOutStream from xStream if that exists;
// opening new SvFileStream in this situation may fail on
// Windows with ERROR_SHARING_VIOLATION
if (pImp->xStream.is())
{
assert(pImp->xStream->getOutputStream().is()); // need that...
pImp->m_pOutStream = utl::UcbStreamHelper::CreateStream(
pImp->xStream, false);
}
else
{
pImp->m_pOutStream = new SvFileStream(
// don't try to re-use XOutStream from xStream if that exists;
// it causes fdo#59022 (fails opening files via SMB on Linux)
// OTOH opening new SvFileStream in this situation may fail on
// Windows with ERROR_SHARING_VIOLATION... but that is apparently
// not a problem in practice currently
pImp->m_pOutStream = new SvFileStream(
pImp->m_aName, STREAM_STD_READWRITE);
}
CloseStorage();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment