From 02caa6e40cfa55d96befc82515b343045b5cfd7b Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 24 Feb 2022 16:17:46 +0200 Subject: renames in template manager creates xml file in wrong location revert part of commit dd42f133f604ee2f7e0ffbca6a8d94fb8f95dfe5 Author: Noel Grandin Date: Mon Jan 10 19:37:05 2022 +0200 tdf#146375 Cannot rename user-defined categories in template manager specifically, revert the > Simplify the UCB usage to just write the contents of the tempfile and also call SvStream::Flush() in utl::TempFile::GetURL(), so that the data actually hits the disk, so that when UCB attempts to read the data using a separate file handle, it sees the data. (Otherwise the temporary file data only exists in the operating system buffers, and can only be read by the same file handle that created it) Change-Id: I17798c53e49d65484605f2dcd96b45babd70054d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130499 Tested-by: Jenkins Reviewed-by: Noel Grandin --- unotools/source/ucbhelper/tempfile.cxx | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'unotools') diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx index 07889ffdab83..cccad1c367f0 100644 --- a/unotools/source/ucbhelper/tempfile.cxx +++ b/unotools/source/ucbhelper/tempfile.cxx @@ -413,6 +413,13 @@ OUString TempFile::GetFileName() const OUString const & TempFile::GetURL() const { + // if you request the URL, then you presumably want to access this via UCB, + // and UCB will want to open the file via a separate file handle, which means + // we have to make this file data actually hit disk. We do this here (and not + // elsewhere) to make the other (normal) paths fast. Flushing to disk + // really slows temp files down. + if (pStream) + pStream->Flush(); return aName; } -- cgit