summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2012-11-17 21:17:07 +0000
committerMichael Meeks <michael.meeks@suse.com>2012-11-19 17:44:54 +0000
commit19e8dd66cb8a66536e19fc7780fbc1101be13710 (patch)
treee2743b6e7130ee7484ce3fd7d2e360fe0c874fbb
parent0d89cf29adf79fb0fc673b836ffd39ccf65b3383 (diff)
Revert "sb140: #i117084# do not leak Lockfile instance"
This reverts commit 1d38dbab29245e430792f7b3a4c14c94cd011504. Conflicts: desktop/source/app/app.cxx
-rw-r--r--desktop/inc/app.hxx3
-rw-r--r--desktop/source/app/app.cxx23
-rw-r--r--desktop/source/deployment/inc/lockfile.hxx3
-rw-r--r--desktop/source/deployment/misc/lockfile.cxx9
4 files changed, 32 insertions, 6 deletions
diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx
index 4f56c32560e7..edbcde80fad2 100644
--- a/desktop/inc/app.hxx
+++ b/desktop/inc/app.hxx
@@ -31,7 +31,6 @@
// stl includes first
#include <map>
-#include <memory>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <vcl/svapp.hxx>
#include <vcl/timer.hxx>
@@ -197,7 +196,7 @@ class Desktop : public Application
OUString m_aBootstrapErrorMessage;
BootstrapStatus m_aBootstrapStatus;
- std::auto_ptr< Lockfile > m_pLockfile;
+ Lockfile *m_pLockfile;
Timer m_firstRunTimer;
static ResMgr* pResMgr;
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 44821e57b0b6..54405148d471 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -577,6 +577,7 @@ Desktop::Desktop()
: m_bCleanedExtensionCache( false )
, m_bServicesRegistered( false )
, m_aBootstrapError( BE_OK )
+, m_pLockfile( NULL )
{
RTL_LOGFILE_TRACE( "desktop (cd100003) ::Desktop::Desktop" );
}
@@ -673,7 +674,11 @@ void Desktop::DeInit()
::comphelper::setProcessServiceFactory( NULL );
// clear lockfile
- m_pLockfile.reset();
+ if (m_pLockfile != NULL)
+ {
+ delete m_pLockfile;
+ m_pLockfile = NULL;
+ }
OfficeIPCThread::DisableOfficeIPCThread();
if( pSignalHandler )
@@ -734,7 +739,12 @@ sal_Bool Desktop::QueryExit()
{
}
- m_pLockfile.reset();
+ if (m_pLockfile != NULL)
+ {
+ delete m_pLockfile;
+ m_pLockfile = NULL;
+ }
+
}
return bExit;
@@ -1300,7 +1310,11 @@ sal_uInt16 Desktop::Exception(sal_uInt16 nError)
default:
{
- m_pLockfile.reset();
+ if (m_pLockfile != NULL)
+ {
+ delete m_pLockfile;
+ m_pLockfile = NULL;
+ }
if( bRestart )
{
@@ -1454,7 +1468,8 @@ 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.reset( new Lockfile );
+ delete m_pLockfile;
+ m_pLockfile = new Lockfile;
#ifndef ANDROID
if ( !rCmdLineArgs.IsHeadless() && !rCmdLineArgs.IsInvisible() &&
!rCmdLineArgs.IsNoLockcheck() && !m_pLockfile->check( Lockfile_execWarning ))
diff --git a/desktop/source/deployment/inc/lockfile.hxx b/desktop/source/deployment/inc/lockfile.hxx
index 79b88960d623..391dd3dccaba 100644
--- a/desktop/source/deployment/inc/lockfile.hxx
+++ b/desktop/source/deployment/inc/lockfile.hxx
@@ -74,6 +74,9 @@ 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);
diff --git a/desktop/source/deployment/misc/lockfile.cxx b/desktop/source/deployment/misc/lockfile.cxx
index fd9291fecc72..a06907731008 100644
--- a/desktop/source/deployment/misc/lockfile.cxx
+++ b/desktop/source/deployment/misc/lockfile.cxx
@@ -208,6 +208,15 @@ 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