summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorJustin Luth <jluth@mail.com>2023-07-20 13:25:57 -0400
committerJustin Luth <jluth@mail.com>2023-08-07 17:17:47 +0200
commitdb9fa6da9d57853e0089a063ec372e11ce6046a9 (patch)
treed1ff26140d55598cf595c15634e73c5295f0d125 /framework
parentf69a98d1175720db3b1ce5f5ae2c7fc0fc35a2b2 (diff)
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 <jluth@mail.com> Tested-by: Jenkins
Diffstat (limited to 'framework')
-rw-r--r--framework/source/services/autorecovery.cxx9
1 files changed, 9 insertions, 0 deletions
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