unotools/source/ucbhelper/tempfile.cxx |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

New commits:
commit 4743a32b4f991c57e4b8a66adf035b1808ca793a
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed May 18 12:27:59 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed May 18 18:01:19 2022 +0200

    only need to create the folder for temp files once
    
    Change-Id: I805203dc51ca85515150fe0f28fc6464c45453c2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134523
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/unotools/source/ucbhelper/tempfile.cxx 
b/unotools/source/ucbhelper/tempfile.cxx
index e912c609337b..83a523a2bd9b 100644
--- a/unotools/source/ucbhelper/tempfile.cxx
+++ b/unotools/source/ucbhelper/tempfile.cxx
@@ -142,19 +142,18 @@ static OUString ConstructTempDir_Impl( const OUString* 
pParent, bool bCreatePare
 
     if ( aName.isEmpty() )
     {
-        OUString &rTempNameBase_Impl = gTempNameBase_Impl;
-        if (rTempNameBase_Impl.isEmpty())
+        if (gTempNameBase_Impl.isEmpty())
         {
             OUString ustrTempDirURL;
             ::osl::FileBase::RC rc = ::osl::File::getTempDirURL(
                 ustrTempDirURL );
             if (rc == ::osl::FileBase::E_None)
-                rTempNameBase_Impl = ustrTempDirURL;
+                gTempNameBase_Impl = ustrTempDirURL;
+            ensuredir( aName );
         }
         // if no parent or invalid parent : use default directory
-        DBG_ASSERT( !rTempNameBase_Impl.isEmpty(), "No TempDir!" );
-        aName = rTempNameBase_Impl;
-        ensuredir( aName );
+        DBG_ASSERT( !gTempNameBase_Impl.isEmpty(), "No TempDir!" );
+        aName = gTempNameBase_Impl;
     }
 
     // Make sure that directory ends with a separator

Reply via email to