Resolves: rhbz#2104545 Avoid call to utl::IsYounger if possible

f41
Stephan Bergmann 2 years ago
parent 9cb8d75ea6
commit e374187b12

@ -0,0 +1,70 @@
From c3afc3ba94500f726475adc895de6c92814ae8bb Mon Sep 17 00:00:00 2001
From: Stephan Bergmann <sbergman@redhat.com>
Date: Fri, 8 Jul 2022 16:47:01 +0200
Subject: [PATCH] rhbz#2104545: Only call utl::IsYounger when its result is
actually used
...as it may be expensive, or even throw (uncaught) exceptions (as apparently
happened at rhbz#2104545, throwing some css::uno::RuntimeException while aMedObj
was an sftp URL).
The two branches in the if statement's condition that will now potentially call
physObjIsOlder are disjoint (one for aMedObj being a file URL, the other for
aMedObj being any WebDAV-related URL), so there is no chance that this change
accidentally causes utl::IsYounger to be called more often than it used to be
called.
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136904
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
(cherry picked from commit 27ffdcf096a7e9863489599dd80528b088d1e9b8)
Conflicts:
sfx2/source/view/viewfrm.cxx
Change-Id: I29a5f18a12a8b83ec603366db26451175b5622c9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136909
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
---
sfx2/source/view/viewfrm.cxx | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index ecae96b5d945..7f3bf1a6bcc2 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -270,6 +270,11 @@ bool AskPasswordToModify_Impl( const uno::Reference< task::XInteractionHandler >
return bResult;
}
+
+bool physObjIsOlder(INetURLObject const & aMedObj, INetURLObject const & aPhysObj) {
+ return ::utl::UCBContentHelper::IsYounger(aMedObj.GetMainURL( INetURLObject::DecodeMechanism::NONE),
+ aPhysObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
+}
}
void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
@@ -438,8 +443,6 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
// etag tells that the cache representation (e.g. in LO) is different from the one on the server,
// but tells nothing about the age
// Details at this link: http://tools.ietf.org/html/rfc4918#section-15, section 15.7
- bool bPhysObjIsYounger = ::utl::UCBContentHelper::IsYounger( aMedObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ),
- aPhysObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
bool bIsWebDAV = aMedObj.isAnyKnownWebDAVScheme();
// tdf#118938 Reload the document when the user enters the editing password,
@@ -447,8 +450,8 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
if ( ( !bNeedsReload && ( ( aMedObj.GetProtocol() == INetProtocol::File &&
( aMedObj.getFSysPath( FSysStyle::Detect ) != aPhysObj.getFSysPath( FSysStyle::Detect )
|| bPasswordEntered ) &&
- !bPhysObjIsYounger )
- || ( bIsWebDAV && !bPhysObjIsYounger )
+ !physObjIsOlder(aMedObj, aPhysObj) )
+ || ( bIsWebDAV && !physObjIsOlder(aMedObj, aPhysObj) )
|| ( pMed->IsRemote() && !bIsWebDAV ) ) )
|| pVersionItem )
// <- tdf#82744
--
2.36.1

@ -62,7 +62,7 @@ Summary: Free Software Productivity Suite
Name: libreoffice
Epoch: 1
Version: %{libo_version}.2
Release: 3%{?libo_prerelease}%{?dist}
Release: 4%{?libo_prerelease}%{?dist}
License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and MPLv2.0 and CC0
URL: http://www.libreoffice.org/
@ -255,6 +255,7 @@ Patch4: 0001-workaround-x86-ICE-with-gcc-12.patch
Patch5: 0001-s390x-canvas-test-fails.patch
Patch6: 0001-tdf-144862-use-resolution-independent-positions-for-.patch
Patch7: 0001-rhbz-2097411-Avoid-obsolete-PyThreadState_Delete-cra.patch
Patch8: 0001-rhbz-2104545-Only-call-utl-IsYounger-when-its-result.patch
# not upstreamed
Patch500: 0001-disable-libe-book-support.patch
@ -2193,6 +2194,9 @@ gtk-update-icon-cache -q %{_datadir}/icons/hicolor &>/dev/null || :
%{_includedir}/LibreOfficeKit
%changelog
* Mon Jul 11 2022 Stephan Bergmann <sbergman@redhat.com> - 1:7.1.3.2-3
- Resolves: rhbz#2104545 Avoid call to utl::IsYounger if possible
* Thu Jun 23 2022 Parag Nemade <pnemade AT redhat DOT com> - 1:7.3.4.2-3
- Fix Requires: hunspell-pt-BR and hyphen-pt-BR for libreoffice-langpack-pt-BR

Loading…
Cancel
Save