summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2014-08-10 14:45:19 +0300
committerAndras Timar <andras.timar@collabora.com>2014-09-17 13:02:34 +0200
commitf52ddf6d6e117479e68ca8a20ea6f47378718081 (patch)
tree03f4b8834988d6e70694ee59b1ee54e602981aa1 /framework
parent7956d38fa3c0db77b9b2b41f870bd3587e3dc1af (diff)
fdo#71625 Don't loop autosave if userautosave fails
Should also fix most of the reports of fdo#46635 (I have no idea regarding the original report, because it predates the autosave feature.) Change-Id: I006d62053a159ab3157438a57dee56d6d99990a8 (cherry picked from commit 5b9509115bd4adc5ef2618f0d9436cda1c0d9fbe) Reviewed-on: https://gerrit.libreoffice.org/10859 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com> (cherry picked from commit 9799a623161f43a0ca0c7a4806416ce466b558a6) Signed-off-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'framework')
-rw-r--r--framework/source/services/autorecovery.cxx24
1 files changed, 17 insertions, 7 deletions
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx
index 3a18af4edebe..4dfa3edc38ee 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -2335,6 +2335,23 @@ void AutoRecovery::implts_saveOneDoc(const OUString&
rInfo.DocumentState |= AutoRecovery::E_TRY_SAVE;
implts_flushConfigItem(rInfo);
+ // 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.
+ 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 & AutoRecovery::E_USER_AUTO_SAVE) == AutoRecovery::E_USER_AUTO_SAVE && !rInfo.OrgURL.isEmpty())
+ {
+ Reference< XStorable > xDocSave(rInfo.Document, css::uno::UNO_QUERY_THROW);
+ xDocSave->store();
+ }
+ }
+ catch(const css::uno::Exception&)
+ {
+ }
+
sal_Int32 nRetry = RETRY_STORE_ON_FULL_DISC_FOREVER;
sal_Bool bError = sal_False;
do
@@ -2343,13 +2360,6 @@ void AutoRecovery::implts_saveOneDoc(const OUString&
{
xDocRecover->storeToRecoveryFile( rInfo.NewTempURL, lNewArgs.getAsConstPropertyValueList() );
- // if userautosave is enabled, also save to the original file
- if((m_eJob & AutoRecovery::E_USER_AUTO_SAVE) == AutoRecovery::E_USER_AUTO_SAVE)
- {
- Reference< XStorable > xDocSave(rInfo.Document, css::uno::UNO_QUERY_THROW);
- xDocSave->store();
- }
-
#ifdef TRIGGER_FULL_DISC_CHECK
throw css::uno::Exception();
#else // TRIGGER_FULL_DISC_CHECK