From 1d38dbab29245e430792f7b3a4c14c94cd011504 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 9 Sep 2011 14:41:53 +0200 Subject: sb140: #i117084# do not leak Lockfile instance plus improvements based on a14010cb8c485ee1d07530d34a00f03db3233e02 "valgrind: fix leak" --- desktop/source/app/app.cxx | 22 ++++------------------ desktop/source/app/lockfile.cxx | 9 --------- desktop/source/app/lockfile.hxx | 3 --- 3 files changed, 4 insertions(+), 30 deletions(-) (limited to 'desktop/source') diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index efe2038a69ec..bf486472d25a 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -676,7 +676,6 @@ throw() Desktop::Desktop() : m_bServicesRegistered( false ) , m_aBootstrapError( BE_OK ) -, m_pLockfile( NULL ) { RTL_LOGFILE_TRACE( "desktop (cd100003) ::Desktop::Desktop" ); } @@ -797,11 +796,7 @@ void Desktop::DeInit() ::comphelper::setProcessServiceFactory( NULL ); // clear lockfile - if (m_pLockfile != NULL) - { - delete m_pLockfile; - m_pLockfile = NULL; - } + m_pLockfile.reset(); OfficeIPCThread::DisableOfficeIPCThread(); if( pSignalHandler ) @@ -862,12 +857,7 @@ sal_Bool Desktop::QueryExit() { } - if (m_pLockfile != NULL) - { - delete m_pLockfile; - m_pLockfile = NULL; - } - + m_pLockfile.reset(); } return bExit; @@ -1482,11 +1472,7 @@ sal_uInt16 Desktop::Exception(sal_uInt16 nError) default: { - if (m_pLockfile != NULL) - { - delete m_pLockfile; - m_pLockfile = NULL; - } + m_pLockfile.reset(); if( bRestart ) { @@ -1633,7 +1619,7 @@ int Desktop::Main() // check user installation directory for lockfile so we can be sure // there is no other instance using our data files from a remote host RTL_LOGFILE_CONTEXT_TRACE( aLog, "desktop (lo119109) Desktop::Main -> Lockfile" ); - m_pLockfile = new Lockfile; + m_pLockfile.reset( new Lockfile ); if ( !rCmdLineArgs.IsHeadless() && !rCmdLineArgs.IsInvisible() && !rCmdLineArgs.IsNoLockcheck() && !m_pLockfile->check( Lockfile_execWarning )) { diff --git a/desktop/source/app/lockfile.cxx b/desktop/source/app/lockfile.cxx index 72632bdb5e27..98ddb7f18cd8 100644 --- a/desktop/source/app/lockfile.cxx +++ b/desktop/source/app/lockfile.cxx @@ -210,15 +210,6 @@ namespace desktop { aConfig.Flush( ); } - void Lockfile::clean( void ) - { - if ( m_bRemove ) - { - File::remove( m_aLockname ); - m_bRemove = sal_False; - } - } - Lockfile::~Lockfile( void ) { // unlock userdata by removing file diff --git a/desktop/source/app/lockfile.hxx b/desktop/source/app/lockfile.hxx index 5444714ec88c..75a61d62c87d 100644 --- a/desktop/source/app/lockfile.hxx +++ b/desktop/source/app/lockfile.hxx @@ -73,9 +73,6 @@ namespace desktop { // found (iff gui) and returns false when we may not continue sal_Bool check( fpExecWarning execWarning ); - // removes the lockfile. should only be called in exceptional situations - void clean(void); - // removes the lockfile ~Lockfile(void); -- cgit v1.2.3