sfx2/source/doc/docfile.cxx |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

New commits:
commit 09aa700793f3f1b3344558ea8a91b8f4134099de
Author: Michael Stahl <mst...@redhat.com>
Date:   Thu Apr 2 15:57:47 2015 +0200

    tdf#72337: sfx2: make the SfxMedium stream-reuse hack runtime-optional
    
    SfxMedium::GetOutStream() does something different on WNT to solve
    sharing issues on one kind of file server but that causes issues with
    some other kind of file server that worked before.
    
    Make this runtime-changeable with (undocumented) env variable
    SFX_MEDIUM_REUSE_STREAM.
    
    (regression from 3d12549335229aca1a6a57575292111274709992)
    
    Change-Id: Id7a1fc8169dbf09c67a109b36ffa312ef33231c5
    (cherry picked from commit 7c4415407f2df5460d3667aa9f820865a615f57f)
    Reviewed-on: https://gerrit.libreoffice.org/15124
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index a80454d..711cbc7 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -560,8 +560,9 @@ SvStream* SfxMedium::GetOutStream()
         {
             // On windows we try to re-use XOutStream from xStream if that 
exists;
             // because opening new SvFileStream in this situation may fail 
with ERROR_SHARING_VIOLATION
-            #ifdef WNT
-            if (pImp->xStream.is())
+            // TODO: this is a horrible hack that should probably be removed,
+            // somebody needs to investigate this more thoroughly...
+            if (getenv("SFX_MEDIUM_REUSE_STREAM") && pImp->xStream.is())
             {
                 assert(pImp->xStream->getOutputStream().is()); // need that...
                 pImp->m_pOutStream = utl::UcbStreamHelper::CreateStream(
@@ -569,15 +570,11 @@ SvStream* SfxMedium::GetOutStream()
             }
             else
             {
-                pImp->m_pOutStream = new SvFileStream(
-                        pImp->m_aName, STREAM_STD_READWRITE);
-            }
             // On Unix don't try to re-use XOutStream from xStream if that 
exists;
             // it causes fdo#59022 (fails opening files via SMB on Linux)
-            #else
-            pImp->m_pOutStream = new SvFileStream(
-                        pImp->m_aName, STREAM_STD_READWRITE);
-            #endif
+                pImp->m_pOutStream = new SvFileStream(
+                            pImp->m_aName, STREAM_STD_READWRITE);
+            }
             CloseStorage();
         }
     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to