diff options
author | Justin Luth <jluth@mail.com> | 2023-08-01 16:00:33 -0400 |
---|---|---|
committer | Justin Luth <jluth@mail.com> | 2023-08-07 17:43:54 +0200 |
commit | 63bb760acc8aa50c352f3349e8adf3db381b4911 (patch) | |
tree | 7145106ec70c3922c837ed9538905ccf661847df /framework | |
parent | f5d6888bd1b945596684cb643118e0e07477d3fa (diff) |
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 <jluth@mail.com>
Diffstat (limited to 'framework')
-rw-r--r-- | framework/source/services/autorecovery.cxx | 9 |
1 files changed, 7 insertions, 2 deletions
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"); |