Change in core[libreoffice-4-0]: fdo#59022: revert "SfxMedium::GetOutputStream(): re-use exis...

Michael Stahl (via Code Review) gerrit at gerrit.libreoffice.org
Thu Jan 31 14:57:12 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1952

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/52/1952/1

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

Revert commit 0c2206081de38a41597aadfb2255540d6308be63, 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
(cherry picked from commit 0799130b0ba954715d00feb93cef83dd48e29889)
---
M sc/qa/unit/subsequent_export-test.cxx
M sfx2/source/doc/docfile.cxx
2 files changed, 10 insertions(+), 17 deletions(-)



diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 7b0fde8..26fe25c 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -125,7 +125,7 @@
     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,
@@ -148,7 +148,7 @@
     //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");
@@ -163,7 +163,7 @@
     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,
@@ -177,7 +177,7 @@
     //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);
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 85b7981..3ce8ab7 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -636,20 +636,13 @@
 
         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();
         }
     }

-- 
To view, visit https://gerrit.libreoffice.org/1952
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0ab8b4262475e4c8425eebb1413997457e5e9417
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Michael Stahl <mstahl at redhat.com>


More information about the LibreOffice mailing list