framework/source/services/autorecovery.cxx |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit f5d6888bd1b945596684cb643118e0e07477d3fa
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Mon Jul 31 15:23:11 2023 -0400
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Mon Aug 7 17:43:10 2023 +0200

    tdf#57414 autorecovery: don't store unmodified docs in RecoveryList
    
    When a document is successfully saved (manually),
    it is removed from RecoveryList (implts_markDocumentAsSaved)
    and all of the temporary recovery files are removed
    from the user's backup folder.
    
    If the document is automatically saved (UserAutoSave)
    successfully, it doesn't need to remain in the RecoveryList either.
    
    storeToRecoveryFile can benefit from knowing if it will be removed,
    so determine whether to bRemoveIt just prior to that call.
    
    Change-Id: I2cb30b426e600cfe34987a091acaf8826316ede5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155272
    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 1071423da954..816e4f7253a3 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -3096,6 +3096,10 @@ void AutoRecovery::implts_saveOneDoc(const OUString&
     else if (xModify.is())
         rInfo.DocumentState &= ~DocState::Modified;
 
+    // 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);
+
     sal_Int32 nRetry = RETRY_STORE_ON_FULL_DISC_FOREVER;
     bool  bError = false;
     do
@@ -3184,7 +3188,8 @@ void AutoRecovery::implts_saveOneDoc(const OUString&
     rInfo.OldTempURL = rInfo.NewTempURL;
     rInfo.NewTempURL.clear();
 
-    implts_flushConfigItem(rInfo);
+    // If it is modified, a recovery file has just been created, so add to 
RecoveryList.
+    implts_flushConfigItem(rInfo, bRemoveIt, /*bAllowAdd=*/bModified);
 
     // We must know if the user modifies the document again ...
     implts_startModifyListeningOnDoc(rInfo);

Reply via email to