framework/source/services/autorecovery.cxx | 9 +++++++++ 1 file changed, 9 insertions(+)
New commits: commit db9fa6da9d57853e0089a063ec372e11ce6046a9 Author: Justin Luth <jl...@mail.com> AuthorDate: Thu Jul 20 13:25:57 2023 -0400 Commit: Justin Luth <jl...@mail.com> CommitDate: Mon Aug 7 17:17:47 2023 +0200 related tdf#57414 autosave: try harder to know when !IsModified The cache that holds document status did: -saveDocs: for each cached document status: -creates a copy of the cached status -call saveOneDoc: given the copy [-updateModifiedState should get called, updating the cache itself] -saveOneDoc: flushConfig writes copy to RecoveryList (as modified) -cache is updated with the results from saveOneDoc (*pIt = aInfo) Now, it is easily possible that saveOneDoc changed the status from modified, to not modified, wouldn't you think (if UserAutoSave)? But since the copy was never updated, it reported as modified still! storeToRecoveryFile can benefit from knowing the real modified status, so do the update just prior to that call. Change-Id: Iee1ddd0bf7bee25d5ba3e7abb1ac6713295906af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154683 Reviewed-by: Justin Luth <jl...@mail.com> Tested-by: Jenkins diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 4eb7000afeac..1bef7e6f3980 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -3076,6 +3076,15 @@ void AutoRecovery::implts_saveOneDoc(const OUString& { } + // DocState::Modified status cannot be trusted to be accurate, but at least attempt to be so, + // since this rInfo will eventually get assigned to m_lDocCache as the authoritative status. + const Reference<css::util::XModifiable> xModify(rInfo.Document, UNO_QUERY); + const bool bModified = xModify.is() && xModify->isModified(); + if (bModified) + rInfo.DocumentState |= DocState::Modified; + else if (xModify.is()) + rInfo.DocumentState &= ~DocState::Modified; + sal_Int32 nRetry = RETRY_STORE_ON_FULL_DISC_FOREVER; bool bError = false; do