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

New commits:
commit f080ef9daf7519cc53f5f341bfa1d60b1ee4b964
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Tue Aug 1 11:01:54 2023 -0400
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Wed Aug 2 19:15:52 2023 +0200

    tdf#65509 autorecovery: don't UserAutoSave during EmergencySave
    
    Saving overtop of the working document during a crash save
    does not sound like a safe thing to do.
    
    However, an ODF recovery export is attempted
    which will preserve unsaved modifications,
    so avoiding this save should not cause data loss.
    
    Change-Id: Ie993042b4c99d5dfb816727d4bfae5bca694d72f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155166
    Tested-by: Justin Luth <jl...@mail.com>
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index 7bdf5f094b30..c55e869cedf3 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -3058,11 +3058,12 @@ void AutoRecovery::implts_saveOneDoc(const OUString&
     // If userautosave is enabled, first try to save the original file.
     // 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);
     try
     {
         // We must check here for an empty URL to avoid a "This operation is 
not supported on this operating system."
         // message during autosave.
-        if ((m_eJob & Job::UserAutoSave) == Job::UserAutoSave && 
!rInfo.OrgURL.isEmpty())
+        if (!bEmergencySave && m_eJob & Job::UserAutoSave && 
!rInfo.OrgURL.isEmpty())
         {
             Reference< XStorable > xDocSave(rInfo.Document, 
css::uno::UNO_QUERY_THROW);
             xDocSave->store();

Reply via email to