diff options
author | Noel Grandin <noel@peralex.com> | 2021-06-30 10:30:25 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-06-30 11:30:49 +0200 |
commit | ecea9c42d5f1a5e63493fcd92944bd49fb91b338 (patch) | |
tree | 0fe5c6d7157a1d69580efdade16abe63172e717b /unotools/source/ucbhelper | |
parent | 8b3ff370ab0fe2e7593a69513c8ff3df35810c4e (diff) |
fix failure in JunitTest_unotools_complex
Temp files created from OTempFileService are always opened with StreamMode::SHARE_DENYALL.
So normally you can't open them twice.
But the JunitTest_unotools_complex unit test used to work because it exploited a pessimisation in OTempFileService,
where that code would close the file when we read to the end.
Which meant that the unit test could open it again and read it.
However, in
commit 218f36dd614cf828e949f605faaf6a6fd615da26
Date: Sun Jun 20 18:51:12 2021 +0200
tdf#135316 remove OTempFileService pessimisation
I removed that pessimisation.
So make the share mode a little more permissive.
Change-Id: I297a5c9c0505816b399fad29414077d03231ec72
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118146
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unotools/source/ucbhelper')
-rw-r--r-- | unotools/source/ucbhelper/xtempfile.cxx | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/unotools/source/ucbhelper/xtempfile.cxx b/unotools/source/ucbhelper/xtempfile.cxx index 0cc0d8904bac..d0f566c9e26c 100644 --- a/unotools/source/ucbhelper/xtempfile.cxx +++ b/unotools/source/ucbhelper/xtempfile.cxx @@ -234,7 +234,12 @@ void OTempFileService::checkError () const void OTempFileService::checkConnected () { if (!mpStream && mpTempFile) - mpStream = mpTempFile->GetStream( StreamMode::STD_READWRITE ); + { + // Ideally we should open this SHARE_DENYALL, but the JunitTest_unotools_complex test wants to open + // this file directly and read from it. + mpStream = mpTempFile->GetStream(StreamMode::READ | StreamMode::WRITE + | StreamMode::SHARE_DENYWRITE); + } if (!mpStream) throw css::io::NotConnectedException ( OUString(), static_cast < css::uno::XWeak * > (this ) ); |