framework/source/services/autorecovery.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
New commits: commit 63bb760acc8aa50c352f3349e8adf3db381b4911 Author: Justin Luth <jl...@mail.com> AuthorDate: Tue Aug 1 16:00:33 2023 -0400 Commit: Justin Luth <jl...@mail.com> CommitDate: Mon Aug 7 17:43:54 2023 +0200 tdf#57414 autorecovery: avoid unnecessary storeToRecoveryFile With a successful UserAutoBackup, the document is fully saved, and the recoveryInfo entry is removed. So just avoid the recovery that would just be deleted anyway. Change-Id: I3cc9fe2730640df48f450f900f33afc2df7f020a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155273 Tested-by: Jenkins Reviewed-by: Justin Luth <jl...@mail.com> diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 816e4f7253a3..657d8c12106c 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -3073,6 +3073,7 @@ void AutoRecovery::implts_saveOneDoc(const OUString& // Note that we must do it *before* calling storeToRecoveryFile, so in case of failure here // we won't remain with the modified flag set to true, even though the autorecovery save succeeded. const bool bEmergencySave(m_eJob & Job::EmergencySave); + bool bUserAutoSaved = false; try { // We must check here for an empty URL to avoid a "This operation is not supported on this operating system." @@ -3081,6 +3082,7 @@ void AutoRecovery::implts_saveOneDoc(const OUString& { Reference< XStorable > xDocSave(rInfo.Document, css::uno::UNO_QUERY_THROW); xDocSave->store(); + bUserAutoSaved = true; } } catch(const css::uno::Exception&) @@ -3098,7 +3100,7 @@ void AutoRecovery::implts_saveOneDoc(const OUString& // If it is no longer modified, it is the same as on disk, and can be removed from RecoveryList. const bool bRemoveIt - = xModify.is() && !xModify->isModified() && !bEmergencySave && !(m_eJob & Job::SessionSave); + = xModify.is() && !xModify->isModified() && bUserAutoSaved && !(m_eJob & Job::SessionSave); sal_Int32 nRetry = RETRY_STORE_ON_FULL_DISC_FOREVER; bool bError = false; @@ -3106,7 +3108,10 @@ void AutoRecovery::implts_saveOneDoc(const OUString& { try { - xDocRecover->storeToRecoveryFile( rInfo.NewTempURL, lNewArgs.getAsConstPropertyValueList() ); + // skip recovery if it will be removed anyway. + if (!bRemoveIt) + xDocRecover->storeToRecoveryFile(rInfo.NewTempURL, + lNewArgs.getAsConstPropertyValueList()); #ifdef TRIGGER_FULL_DISC_CHECK throw css::uno::Exception("trigger full disk check");