Kaydet (Commit) 7d5c839e authored tarafından Vladimir Glazounov's avatar Vladimir Glazounov

INTEGRATION: CWS calcshare2 (1.25.18); FILE MERGED

2008/03/29 18:40:17 mav 1.25.18.1: #i86677# fix handling of lock files after the crash
üst 62ee5e1a
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* $RCSfile: autorecovery.cxx,v $ * $RCSfile: autorecovery.cxx,v $
* *
* $Revision: 1.27 $ * $Revision: 1.28 $
* *
* This file is part of OpenOffice.org. * This file is part of OpenOffice.org.
* *
...@@ -91,6 +91,8 @@ ...@@ -91,6 +91,8 @@
#include <osl/file.hxx> #include <osl/file.hxx>
#include <unotools/bootstrap.hxx> #include <unotools/bootstrap.hxx>
#include <unotools/configmgr.hxx> #include <unotools/configmgr.hxx>
#include <svtools/documentlockfile.hxx>
#include <tools/urlobj.hxx> #include <tools/urlobj.hxx>
//_______________________________________________ //_______________________________________________
...@@ -2044,6 +2046,30 @@ void AutoRecovery::implts_prepareSessionShutdown() ...@@ -2044,6 +2046,30 @@ void AutoRecovery::implts_prepareSessionShutdown()
// <- SAFE // <- SAFE
} }
//-----------------------------------------------
/* Currently the document is not closed in case of crash,
so the lock file must be removed explicitly
*/
void lc_removeLockFile(AutoRecovery::TDocumentInfo& rInfo)
{
if ( rInfo.Document.is() )
{
try
{
css::uno::Reference< css::frame::XStorable > xStore(rInfo.Document, css::uno::UNO_QUERY_THROW);
::rtl::OUString aURL = xStore->getLocation();
if ( aURL.getLength() )
{
::svt::DocumentLockFile aLockFile( aURL );
aLockFile.RemoveFile();
}
}
catch( const css::uno::Exception& )
{}
}
}
//----------------------------------------------- //-----------------------------------------------
/* TODO WORKAROUND: /* TODO WORKAROUND:
...@@ -2126,6 +2152,9 @@ AutoRecovery::ETimerType AutoRecovery::implts_saveDocs( sal_Bool bAl ...@@ -2126,6 +2152,9 @@ AutoRecovery::ETimerType AutoRecovery::implts_saveDocs( sal_Bool bAl
{ {
AutoRecovery::TDocumentInfo aInfo = *pIt; AutoRecovery::TDocumentInfo aInfo = *pIt;
// WORKAROUND... Since the documents are not closed the lock file must be removed explicitly
lc_removeLockFile( aInfo );
// WORKAROUND ... see comment of this method // WORKAROUND ... see comment of this method
if (lc_checkIfSaveForbiddenByArguments(aInfo)) if (lc_checkIfSaveForbiddenByArguments(aInfo))
continue; continue;
......
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