Kaydet (Commit) 19e8dd66 authored tarafından Michael Meeks's avatar Michael Meeks

Revert "sb140: #i117084# do not leak Lockfile instance"

This reverts commit 1d38dbab.

Conflicts:
	desktop/source/app/app.cxx
üst 0d89cf29
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
// stl includes first // stl includes first
#include <map> #include <map>
#include <memory>
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <vcl/timer.hxx> #include <vcl/timer.hxx>
...@@ -197,7 +196,7 @@ class Desktop : public Application ...@@ -197,7 +196,7 @@ class Desktop : public Application
OUString m_aBootstrapErrorMessage; OUString m_aBootstrapErrorMessage;
BootstrapStatus m_aBootstrapStatus; BootstrapStatus m_aBootstrapStatus;
std::auto_ptr< Lockfile > m_pLockfile; Lockfile *m_pLockfile;
Timer m_firstRunTimer; Timer m_firstRunTimer;
static ResMgr* pResMgr; static ResMgr* pResMgr;
......
...@@ -577,6 +577,7 @@ Desktop::Desktop() ...@@ -577,6 +577,7 @@ Desktop::Desktop()
: m_bCleanedExtensionCache( false ) : m_bCleanedExtensionCache( false )
, m_bServicesRegistered( false ) , m_bServicesRegistered( false )
, m_aBootstrapError( BE_OK ) , m_aBootstrapError( BE_OK )
, m_pLockfile( NULL )
{ {
RTL_LOGFILE_TRACE( "desktop (cd100003) ::Desktop::Desktop" ); RTL_LOGFILE_TRACE( "desktop (cd100003) ::Desktop::Desktop" );
} }
...@@ -673,7 +674,11 @@ void Desktop::DeInit() ...@@ -673,7 +674,11 @@ void Desktop::DeInit()
::comphelper::setProcessServiceFactory( NULL ); ::comphelper::setProcessServiceFactory( NULL );
// clear lockfile // clear lockfile
m_pLockfile.reset(); if (m_pLockfile != NULL)
{
delete m_pLockfile;
m_pLockfile = NULL;
}
OfficeIPCThread::DisableOfficeIPCThread(); OfficeIPCThread::DisableOfficeIPCThread();
if( pSignalHandler ) if( pSignalHandler )
...@@ -734,7 +739,12 @@ sal_Bool Desktop::QueryExit() ...@@ -734,7 +739,12 @@ sal_Bool Desktop::QueryExit()
{ {
} }
m_pLockfile.reset(); if (m_pLockfile != NULL)
{
delete m_pLockfile;
m_pLockfile = NULL;
}
} }
return bExit; return bExit;
...@@ -1300,7 +1310,11 @@ sal_uInt16 Desktop::Exception(sal_uInt16 nError) ...@@ -1300,7 +1310,11 @@ sal_uInt16 Desktop::Exception(sal_uInt16 nError)
default: default:
{ {
m_pLockfile.reset(); if (m_pLockfile != NULL)
{
delete m_pLockfile;
m_pLockfile = NULL;
}
if( bRestart ) if( bRestart )
{ {
...@@ -1454,7 +1468,8 @@ int Desktop::Main() ...@@ -1454,7 +1468,8 @@ int Desktop::Main()
// check user installation directory for lockfile so we can be sure // check user installation directory for lockfile so we can be sure
// there is no other instance using our data files from a remote host // there is no other instance using our data files from a remote host
RTL_LOGFILE_CONTEXT_TRACE( aLog, "desktop (lo119109) Desktop::Main -> Lockfile" ); RTL_LOGFILE_CONTEXT_TRACE( aLog, "desktop (lo119109) Desktop::Main -> Lockfile" );
m_pLockfile.reset( new Lockfile ); delete m_pLockfile;
m_pLockfile = new Lockfile;
#ifndef ANDROID #ifndef ANDROID
if ( !rCmdLineArgs.IsHeadless() && !rCmdLineArgs.IsInvisible() && if ( !rCmdLineArgs.IsHeadless() && !rCmdLineArgs.IsInvisible() &&
!rCmdLineArgs.IsNoLockcheck() && !m_pLockfile->check( Lockfile_execWarning )) !rCmdLineArgs.IsNoLockcheck() && !m_pLockfile->check( Lockfile_execWarning ))
......
...@@ -74,6 +74,9 @@ namespace desktop { ...@@ -74,6 +74,9 @@ namespace desktop {
// found (iff gui) and returns false when we may not continue // found (iff gui) and returns false when we may not continue
sal_Bool check( fpExecWarning execWarning ); sal_Bool check( fpExecWarning execWarning );
// removes the lockfile. should only be called in exceptional situations
void clean(void);
// removes the lockfile // removes the lockfile
~Lockfile(void); ~Lockfile(void);
......
...@@ -208,6 +208,15 @@ namespace desktop { ...@@ -208,6 +208,15 @@ namespace desktop {
aConfig.Flush( ); aConfig.Flush( );
} }
void Lockfile::clean( void )
{
if ( m_bRemove )
{
File::remove( m_aLockname );
m_bRemove = sal_False;
}
}
Lockfile::~Lockfile( void ) Lockfile::~Lockfile( void )
{ {
// unlock userdata by removing file // unlock userdata by removing file
......
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