Kaydet (Commit) 5b950911 authored tarafından Maxim Monastirsky's avatar Maxim Monastirsky

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
üst c64077a8
...@@ -3114,6 +3114,23 @@ void AutoRecovery::implts_saveOneDoc(const OUString& ...@@ -3114,6 +3114,23 @@ void AutoRecovery::implts_saveOneDoc(const OUString&
rInfo.DocumentState |= AutoRecovery::E_TRY_SAVE; rInfo.DocumentState |= AutoRecovery::E_TRY_SAVE;
implts_flushConfigItem(rInfo); 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_Int32 nRetry = RETRY_STORE_ON_FULL_DISC_FOREVER;
bool bError = false; bool bError = false;
do do
...@@ -3122,13 +3139,6 @@ void AutoRecovery::implts_saveOneDoc(const OUString& ...@@ -3122,13 +3139,6 @@ void AutoRecovery::implts_saveOneDoc(const OUString&
{ {
xDocRecover->storeToRecoveryFile( rInfo.NewTempURL, lNewArgs.getAsConstPropertyValueList() ); 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 #ifdef TRIGGER_FULL_DISC_CHECK
throw css::uno::Exception(); throw css::uno::Exception();
#else // TRIGGER_FULL_DISC_CHECK #else // TRIGGER_FULL_DISC_CHECK
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment